[vlc-commits] avcodec: copy the key/values as they will be freed during av_dict_free()

Steve Lhomme git at videolan.org
Fri Aug 5 17:20:21 CEST 2016


vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Fri Aug  5 09:20:04 2016 +0200| [c4f149797003e83e1994c0e9e29f1e6f0b318449] | committer: Jean-Baptiste Kempf

avcodec: copy the key/values as they will be freed during av_dict_free()

av_free() assumes the memory was allocated with av_alloc(). It will assert
if CONFIG_MEMALIGN_HACK is enabled.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/codec/avcodec/avcommon.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/modules/codec/avcodec/avcommon.h b/modules/codec/avcodec/avcommon.h
index 1373487..f612a36 100644
--- a/modules/codec/avcodec/avcommon.h
+++ b/modules/codec/avcodec/avcommon.h
@@ -52,8 +52,9 @@ static inline AVDictionary *vlc_av_get_options(const char *psz_opts)
     config_ChainParseOptions(&cfg, psz_opts);
     while (cfg) {
         config_chain_t *next = cfg->p_next;
-        av_dict_set(&options, cfg->psz_name, cfg->psz_value,
-            AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL);
+        av_dict_set(&options, cfg->psz_name, cfg->psz_value, 0);
+        free(cfg->psz_name);
+        free(cfg->psz_value);
         free(cfg);
         cfg = next;
     }



More information about the vlc-commits mailing list