[FFmpeg-devel] [PATCH 2/4] avutil/opt: set_string: allow src=dst

Michael Niedermayer michaelni at gmx.at
Fri May 30 21:24:23 CEST 2014


Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavutil/opt.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index b4dd0fd..72de041 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -181,7 +181,8 @@ static int set_string_binary(void *obj, const AVOption *o, const char *val, uint
 
 static int set_string(void *obj, const AVOption *o, const char *val, uint8_t **dst)
 {
-    av_freep(dst);
+    if (*dst != val)
+        av_freep(dst);
     *dst = av_strdup(val);
     return 0;
 }
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list