summaryrefslogtreecommitdiff
path: root/libavutil
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2016-12-22 12:11:13 -0300
committerJames Almer <jamrial@gmail.com>2016-12-22 12:11:13 -0300
commit0abcebe3d62df01e7038cc78523e4445089f3b69 (patch)
tree1f7f3edb4e9c54d9d6c634f5d4a48e3e776c2c40 /libavutil
parentc5168b4b542bad1197934cbea2af5c002012c145 (diff)
downloadffmpeg-0abcebe3d62df01e7038cc78523e4445089f3b69.tar.gz
tests/avstring: free the pointer after calls to av_d2str()
Fixes memleaks. Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/tests/avstring.c6
1 files changed, 4 insertions, 2 deletions
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");