From: James Almer Date: Thu, 22 Dec 2016 15:11:13 +0000 (-0300) Subject: tests/avstring: free the pointer after calls to av_d2str() X-Git-Tag: n3.3~1691 X-Git-Url: https://git.videolan.org/?p=ffmpeg.git;a=commitdiff_plain;h=0abcebe3d62df01e7038cc78523e4445089f3b69 tests/avstring: free the pointer after calls to av_d2str() Fixes memleaks. Signed-off-by: James Almer --- diff --git a/libavutil/tests/avstring.c b/libavutil/tests/avstring.c index 290b17086d..14bc7ffcea 100644 --- a/libavutil/tests/avstring.c +++ b/libavutil/tests/avstring.c @@ -97,8 +97,10 @@ int main(void) #define TEST_D2STR(value, expected) \ if((ptr = av_d2str(value)) == NULL){ \ printf("error, received null pointer!\n"); \ - } else if(strcmp(ptr, expected) != 0){ \ - printf( "expected: %s, received: %s\n", expected, ptr); \ + } else { \ + if(strcmp(ptr, expected) != 0) \ + printf( "expected: %s, received: %s\n", expected, ptr); \ + av_free(ptr); \ } TEST_D2STR(0 , "0.000000"); TEST_D2STR(-1.2333234, "-1.233323");