[FFmpeg-cvslog] avutil/opt: try to fix the case where src==dst in av_opt_copy()

Michael Niedermayer git at videolan.org
Thu Jul 17 06:23:49 CEST 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Jul 17 05:56:40 2014 +0200| [7cd6d61da53cad48703e6bf9e6aad003f1dfec20] | committer: Michael Niedermayer

avutil/opt: try to fix the case where src==dst in av_opt_copy()

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavutil/opt.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index 694295d..505e010 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -1559,7 +1559,9 @@ int av_opt_copy(void *dst, void *src)
         uint8_t **field_src8 = (uint8_t**)field_src;
 
         if (o->type == AV_OPT_TYPE_STRING) {
-            set_string(dst, o, *field_src8, field_dst8);
+            if (*field_dst8 != *field_src8)
+                av_freep(field_dst8);
+            *field_dst8 = av_strdup(*field_src8);
             if (*field_src8 && !*field_dst8)
                 ret = AVERROR(ENOMEM);
         } else if (o->type == AV_OPT_TYPE_BINARY) {



More information about the ffmpeg-cvslog mailing list