aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-09-13 21:20:11 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-09-14 15:03:59 +0200
commitf976ed7fcf61324451e73876840c9473125f371b (patch)
tree4aec4bce4c39be3e2338ff206e060a41ab79be7a /libavutil
parent62af385b917f2474498abeabd6057e6c60e2b9a9 (diff)
downloadffmpeg-f976ed7fcf61324451e73876840c9473125f371b.tar.gz
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>
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/dict.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavutil/dict.c b/libavutil/dict.c
index a4f638a1fc..d127bb90aa 100644
--- a/libavutil/dict.c
+++ b/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;