[PATCH] Fix smbtorture memory leaks

David Disseldorp ddiss at samba.org
Wed May 16 11:36:39 UTC 2018


On Wed, 16 May 2018 12:14:11 +0200, Andreas Schneider via samba-technical wrote:

> -	torture_assert_int_equal(tctx, smbc_get ##option(ctx), val, "failed " #option);
> +	torture_assert_int_equal_goto(tctx, smbc_get ##option(ctx), val, ok, done, "failed " #option);
>  
>  #define TEST_OPTION_STRING(option, val) \
>  	torture_comment(tctx, "Testing smbc_set" #option "\n");\
>  	smbc_set ##option(ctx, strdup(val));\
>  	torture_comment(tctx, "Testing smbc_get" #option "\n");\
> -	torture_assert_str_equal(tctx, smbc_get ##option(ctx), val, "failed " #option);
> +	torture_assert_str_equal_goto(tctx, smbc_get ##option(ctx), val, ok, done, "failed " #option);

Gah, I know this is just test code, but please don't add extra macros
that use magic labels and variables. My preference would be to just
move the torture_assert out of the TEST_OPTION_X() macros and into the
caller.

Cheers, David



More information about the samba-technical mailing list