ffmpeg | branch: master | Andreas Rheinhardt <[email protected]> | 
Tue Sep 13 21:20:11 2022 +0200| [f976ed7fcf61324451e73876840c9473125f371b] | 
committer: Andreas Rheinhardt

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 <[email protected]>
Signed-off-by: Andreas Rheinhardt <[email protected]>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f976ed7fcf61324451e73876840c9473125f371b
---

 libavutil/dict.c | 8 ++++----
 1 file 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;
 

_______________________________________________
ffmpeg-cvslog mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to