]> git.sesse.net Git - ffmpeg/commitdiff
ffmpeg: use av_asprintf() in opt_old2new() and fix a memleak.
authorClément Bœsch <ubitux@gmail.com>
Fri, 13 Jan 2012 00:53:34 +0000 (01:53 +0100)
committerClément Bœsch <ubitux@gmail.com>
Fri, 13 Jan 2012 15:22:20 +0000 (16:22 +0100)
ffmpeg.c

index 125a143993ac0e6e374f2dab1296b4a261fb95a1..47c56cb9cbb056849e4a0271c5a8c2e0265403ea 100644 (file)
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -4866,9 +4866,9 @@ static int opt_passlogfile(const char *opt, const char *arg)
 
 static int opt_old2new(OptionsContext *o, const char *opt, const char *arg)
 {
-    char *s= av_malloc(strlen(opt)+2);
-    snprintf(s, strlen(opt)+2, "%s:%c", opt+1, *opt);
-    return parse_option(o, s, arg, options);
+    char *s = av_asprintf("%s:%c", opt + 1, *opt);
+    parse_option(o, s, arg, options);
+    av_free(s);
 }
 
 static int opt_bitrate(OptionsContext *o, const char *opt, const char *arg)