[apparmor] Memory leaks in parser/parser_regex.c (at least)

Seth Arnold seth.arnold at canonical.com
Thu Aug 27 19:19:42 UTC 2015


On Thu, Aug 27, 2015 at 10:35:11AM -0700, Steve Beattie wrote:
> Nope, that's more unit tests leaking memory. Try the following patch:
> 
> Signed-off-by: Steve Beattie <steve at nxnw.org>

Acked-by: Seth Arnold <seth.arnold at canonical.com>

Thanks

> ---
>  libraries/libapparmor/src/tst_aalogmisc.c |    6 ++++++
>  1 file changed, 6 insertions(+)
> 
> Index: b/libraries/libapparmor/src/tst_aalogmisc.c
> ===================================================================
> --- a/libraries/libapparmor/src/tst_aalogmisc.c
> +++ b/libraries/libapparmor/src/tst_aalogmisc.c
> @@ -34,19 +34,25 @@ int main(void)
>  	retstr = hex_to_string("2F746D702F646F6573206E6F74206578697374");
>  	MY_TEST(retstr, "basic allocation");
>  	MY_TEST(strcmp(retstr, "/tmp/does not exist") == 0, "basic dehex 1");
> +	free(retstr);
>  
>  	retstr = hex_to_string("61");
>  	MY_TEST(strcmp(retstr, "a") == 0, "basic dehex 2");
> +	free(retstr);
>  
>  	retstr = hex_to_string("");
>  	MY_TEST(strcmp(retstr, "") == 0, "empty string");
> +	free(retstr);
>  
>  	/* ipproto_to_string() tests */
>  	retstr = ipproto_to_string((unsigned) 99999);
>  	MY_TEST(strcmp(retstr, "unknown(99999)") == 0, "invalid protocol test");
> +	free(retstr);
>  
>  	retstr = ipproto_to_string((unsigned) 6);
>  	MY_TEST(strcmp(retstr, "tcp") == 0, "protocol=tcp");
> +	free(retstr);
> +
>  	return rc;
>  }

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20150827/85dadc20/attachment.pgp>


More information about the AppArmor mailing list