avutil/dict: Avoid check whose result is known in advance

We know that an AVDictionary is not empty if we have just added
an entry to it, so only check for it being empty on the branch
that does not do so.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2022-09-13 21:20:11 +02:00
parent 62af385b91
commit f976ed7fcf

View File

@ -126,12 +126,12 @@ int av_dict_set(AVDictionary **pm, const char *key, const char *value,
}
m->count++;
} else {
if (!m->count) {
av_freep(&m->elems);
av_freep(pm);
}
av_freep(&copy_key);
}
if (!m->count) {
av_freep(&m->elems);
av_freep(pm);
}
return 0;