[FFmpeg-cvslog] avutil/dict: do not realloc entries when deleting a non-existing item

Marton Balint git at videolan.org
Tue Mar 15 01:02:39 CET 2016


ffmpeg | branch: master | Marton Balint <cus at passwd.hu> | Sat Feb  6 17:23:02 2016 +0100| [a740263d7e7be5bb909ae83a44b21cc8cf8c9274] | committer: Marton Balint

avutil/dict: do not realloc entries when deleting a non-existing item

Deleting a non-existing item should not invalidate existing entries returned
with av_dict_get.

Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: Marton Balint <cus at passwd.hu>

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

 libavutil/dict.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/dict.c b/libavutil/dict.c
index 8bb65a1..1203562 100644
--- a/libavutil/dict.c
+++ b/libavutil/dict.c
@@ -98,7 +98,7 @@ int av_dict_set(AVDictionary **pm, const char *key, const char *value,
             av_free(tag->value);
         av_free(tag->key);
         *tag = m->elems[--m->count];
-    } else {
+    } else if (copy_value) {
         AVDictionaryEntry *tmp = av_realloc(m->elems,
                                             (m->count + 1) * sizeof(*m->elems));
         if (!tmp)



More information about the ffmpeg-cvslog mailing list