[FFmpeg-cvslog] ffmpeg: use av_asprintf() in opt_old2new() and fix a memleak.

Clément Bœsch git at videolan.org
Fri Jan 13 16:22:45 CET 2012


ffmpeg | branch: master | Clément Bœsch <ubitux at gmail.com> | Fri Jan 13 01:53:34 2012 +0100| [e3127db43877c7587975f58922b6087cea4ed706] | committer: Clément Bœsch

ffmpeg: use av_asprintf() in opt_old2new() and fix a memleak.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e3127db43877c7587975f58922b6087cea4ed706
---

 ffmpeg.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 125a143..47c56cb 100644
--- 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)



More information about the ffmpeg-cvslog mailing list