Skip to content
Snippets Groups Projects
Commit 336bb3f7 authored by Michael Niedermayer's avatar Michael Niedermayer
Browse files

avutil/dict: Use av_freep() to avoid leaving stale pointers in memory

parent 9e893473
No related branches found
No related tags found
No related merge requests found
......@@ -120,7 +120,7 @@ int av_dict_set(AVDictionary **pm, const char *key, const char *value,
m->count++;
}
if (!m->count) {
av_free(m->elems);
av_freep(&m->elems);
av_freep(pm);
}
......@@ -128,7 +128,7 @@ int av_dict_set(AVDictionary **pm, const char *key, const char *value,
err_out:
if (m && !m->count) {
av_free(m->elems);
av_freep(&m->elems);
av_freep(pm);
}
if (flags & AV_DICT_DONT_STRDUP_KEY) av_free((void*)key);
......@@ -197,10 +197,10 @@ void av_dict_free(AVDictionary **pm)
if (m) {
while (m->count--) {
av_free(m->elems[m->count].key);
av_free(m->elems[m->count].value);
av_freep(&m->elems[m->count].key);
av_freep(&m->elems[m->count].value);
}
av_free(m->elems);
av_freep(&m->elems);
}
av_freep(pm);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment