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>
pull/388/head
Andreas Rheinhardt 2 years ago
parent 62af385b91
commit f976ed7fcf
  1. 8
      libavutil/dict.c

@ -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;

Loading…
Cancel
Save