On 9/13/22, Andreas Rheinhardt <andreas.rheinha...@outlook.com> wrote:
> 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.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com>
> ---
>  libavutil/dict.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>

LGTM

> diff --git a/libavutil/dict.c b/libavutil/dict.c
> index 1968063b0b..4bba041d0a 100644
> --- a/libavutil/dict.c
> +++ b/libavutil/dict.c
> @@ -123,12 +123,12 @@ int av_dict_set(AVDictionary **pm, const char *key,
> const char *value,
>          m->elems[m->count].value = copy_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;
>
> --
> 2.34.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to