[FFmpeg-devel] [PATCH 4/5] lavu/dict: use av_dynarray_alloc_elem().
Clément Bœsch
ubitux at gmail.com
Sun Apr 14 03:07:57 CEST 2013
---
libavutil/dict.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/libavutil/dict.c b/libavutil/dict.c
index 64ddffd..7a92c56 100644
--- a/libavutil/dict.c
+++ b/libavutil/dict.c
@@ -78,11 +78,9 @@ int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags
av_free(tag->key);
*tag = m->elems[--m->count];
} else {
- AVDictionaryEntry *tmp = av_realloc(m->elems, (m->count+1) * sizeof(*m->elems));
- if(tmp) {
- m->elems = tmp;
- } else
+ if (!av_dynarray_alloc_elem((void **)&m->elems, &m->count, sizeof(*m->elems)))
return AVERROR(ENOMEM);
+ m->count--;
}
if (value) {
AVDictionaryEntry *e = &m->elems[m->count++];
--
1.8.2.1
More information about the ffmpeg-devel
mailing list