diff mbox series

[FFmpeg-devel,V1,04/12] lavc/libvpxenc: fix memory leak after av_dict_parse_string fail

Message ID 1577856040-17409-4-git-send-email-mypopydev@gmail.com
State New
Headers show
Series [FFmpeg-devel,V1,01/12] lavc/bsf: fix memory leak after av_dict_parse_string fail | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork fail Failed to apply patch

Commit Message

Jun Zhao Jan. 1, 2020, 5:20 a.m. UTC
From: Jun Zhao <barryjzhao@tencent.com>

In case of failure, all the successfully set entries are stored in
*pm. We need to manually free the created dictionary to avoid
memory leak.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
---
 libavcodec/libvpxenc.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

Comments

James Zern Jan. 3, 2020, 11:26 p.m. UTC | #1
Hi,

On Tue, Dec 31, 2019 at 9:21 PM Jun Zhao <mypopydev@gmail.com> wrote:
>
> From: Jun Zhao <barryjzhao@tencent.com>
>
> In case of failure, all the successfully set entries are stored in
> *pm. We need to manually free the created dictionary to avoid
> memory leak.
>
> Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
> ---
>  libavcodec/libvpxenc.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
>

I think this is unnecessary after:
9ac1066dc6 avcodec/libvpxenc: use AV_OPT_TYPE_DICT for ts-parameters
Jun Zhao Jan. 6, 2020, 1:42 a.m. UTC | #2
On Sat, Jan 4, 2020 at 7:34 AM James Zern
<jzern-at-google.com@ffmpeg.org> wrote:
>
> Hi,
>
> On Tue, Dec 31, 2019 at 9:21 PM Jun Zhao <mypopydev@gmail.com> wrote:
> >
> > From: Jun Zhao <barryjzhao@tencent.com>
> >
> > In case of failure, all the successfully set entries are stored in
> > *pm. We need to manually free the created dictionary to avoid
> > memory leak.
> >
> > Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
> > ---
> >  libavcodec/libvpxenc.c |    3 +--
> >  1 files changed, 1 insertions(+), 2 deletions(-)
> >
>
> I think this is unnecessary after:
> 9ac1066dc6 avcodec/libvpxenc: use AV_OPT_TYPE_DICT for ts-parameters
Yes, so rebase the patchset with version 2 for other part, thx
diff mbox series

Patch

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 721a052..e9b3793 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -768,9 +768,8 @@  FF_ENABLE_DEPRECATION_WARNINGS
                            "Error parsing option '%s = %s'.\n",
                            en->key, en->value);
             }
-
-            av_dict_free(&dict);
         }
+        av_dict_free(&dict);
     }
 
     dump_enc_cfg(avctx, &enccfg);