[FFmpeg-cvslog] tests/avstring: free the pointer after calls to av_d2str()
James Almer
git at videolan.org
Thu Dec 22 20:12:17 EET 2016
ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Thu Dec 22 12:11:13 2016 -0300| [0abcebe3d62df01e7038cc78523e4445089f3b69] | committer: James Almer
tests/avstring: free the pointer after calls to av_d2str()
Fixes memleaks.
Signed-off-by: James Almer <jamrial at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0abcebe3d62df01e7038cc78523e4445089f3b69
---
libavutil/tests/avstring.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libavutil/tests/avstring.c b/libavutil/tests/avstring.c
index 290b170..14bc7ff 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");
More information about the ffmpeg-cvslog
mailing list