[FFmpeg-cvslog] ffmpeg_opt: Fix memleaks in "manually set programs" loop
Michael Niedermayer
git at videolan.org
Mon Feb 8 15:58:20 CET 2016
ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Mon Feb 8 15:23:51 2016 +0100| [a25c5dbb5ee0f54c474d9caf43359cd0f61ae1bf] | committer: Michael Niedermayer
ffmpeg_opt: Fix memleaks in "manually set programs" loop
Fixes CID1351356, CID1351357
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a25c5dbb5ee0f54c474d9caf43359cd0f61ae1bf
---
ffmpeg_opt.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index 669976b..bc8355e 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -2366,18 +2366,25 @@ loop_end:
while(*p) {
const char *p2 = av_get_token(&p, ":");
+ const char *to_dealloc = p2;
char *key;
if (!p2)
break;
+
if(*p) p++;
key = av_get_token(&p2, "=");
- if (!key || !*p2)
+ if (!key || !*p2) {
+ av_freep(&to_dealloc);
+ av_freep(&key);
break;
+ }
p2++;
if (!strcmp(key, "program_num"))
progid = strtol(p2, NULL, 0);
+ av_freep(&to_dealloc);
+ av_freep(&key);
}
program = av_new_program(oc, progid);
@@ -2385,6 +2392,7 @@ loop_end:
p = o->program[i].u.str;
while(*p) {
const char *p2 = av_get_token(&p, ":");
+ const char *to_dealloc = p2;
char *key;
if (!p2)
break;
@@ -2411,6 +2419,8 @@ loop_end:
av_log(NULL, AV_LOG_FATAL, "Unknown program key %s.\n", key);
exit_program(1);
}
+ av_freep(&to_dealloc);
+ av_freep(&key);
}
}
More information about the ffmpeg-cvslog
mailing list