[FFmpeg-devel] [PATCH 09/11] Duplicate arg string in opt_format() and opt_video_rc_override_string(), since arg may be a non statically allocated string.

Stefano Sabatini stefano.sabatini-lala
Fri Nov 12 19:31:47 CET 2010


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

diff --git a/ffmpeg.c b/ffmpeg.c
index 449dfe6..26bc0d7 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2708,12 +2708,16 @@ static int transcode(AVFormatContext **output_files,
 
 static void opt_format(const char *arg)
 {
-    last_asked_format = arg;
+    if (last_asked_format)
+        av_freep(&last_asked_format);
+    last_asked_format = av_strdup(arg);
 }
 
 static void opt_video_rc_override_string(const char *arg)
 {
-    video_rc_override_string = arg;
+    if (video_rc_override_string)
+        av_freep(&video_rc_override_string);
+    video_rc_override_string = av_strdup(arg);
 }
 
 static int opt_me_threshold(const char *opt, const char *arg)
-- 
1.7.1




More information about the ffmpeg-devel mailing list