diff mbox series

[FFmpeg-devel,04/19] avfilter/vf_premultiply: Fix leak of names of inpads

Message ID 20200825140927.16433-4-andreas.rheinhardt@gmail.com
State Accepted
Commit 7e736cd38aed1886fcc9672848ccf31ea1cc0b28
Headers show
Series [FFmpeg-devel,01/19] avfilter/avfilter: Fix indentation | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Aug. 25, 2020, 2:09 p.m. UTC
These names leak because freeing them in the uninit function has been
forgotten. Instead of adding the freeing code, this commit stops
allocating these names. They are constants anyway.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavfilter/vf_premultiply.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

Comments

Paul B Mahol Aug. 26, 2020, 8:20 p.m. UTC | #1
On 8/25/20, Andreas Rheinhardt <andreas.rheinhardt@gmail.com> wrote:
> These names leak because freeing them in the uninit function has been
> forgotten. Instead of adding the freeing code, this commit stops
> allocating these names. They are constants anyway.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavfilter/vf_premultiply.c | 16 ++++------------
>  1 file changed, 4 insertions(+), 12 deletions(-)
>

LGTM

> diff --git a/libavfilter/vf_premultiply.c b/libavfilter/vf_premultiply.c
> index 1fef4777de..5d053b1f77 100644
> --- a/libavfilter/vf_premultiply.c
> +++ b/libavfilter/vf_premultiply.c
> @@ -673,27 +673,19 @@ static av_cold int init(AVFilterContext *ctx)
>          s->inverse = 1;
>
>      pad.type         = AVMEDIA_TYPE_VIDEO;
> -    pad.name         = av_strdup("main");
> +    pad.name         = "main";
>      pad.config_props = config_input;
> -    if (!pad.name)
> -        return AVERROR(ENOMEM);
>
> -    if ((ret = ff_insert_inpad(ctx, 0, &pad)) < 0) {
> -        av_freep(&pad.name);
> +    if ((ret = ff_insert_inpad(ctx, 0, &pad)) < 0)
>          return ret;
> -    }
>
>      if (!s->inplace) {
>          pad.type         = AVMEDIA_TYPE_VIDEO;
> -        pad.name         = av_strdup("alpha");
> +        pad.name         = "alpha";
>          pad.config_props = NULL;
> -        if (!pad.name)
> -            return AVERROR(ENOMEM);
>
> -        if ((ret = ff_insert_inpad(ctx, 1, &pad)) < 0) {
> -            av_freep(&pad.name);
> +        if ((ret = ff_insert_inpad(ctx, 1, &pad)) < 0)
>              return ret;
> -        }
>      }
>
>      return 0;
> --
> 2.20.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-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/libavfilter/vf_premultiply.c b/libavfilter/vf_premultiply.c
index 1fef4777de..5d053b1f77 100644
--- a/libavfilter/vf_premultiply.c
+++ b/libavfilter/vf_premultiply.c
@@ -673,27 +673,19 @@  static av_cold int init(AVFilterContext *ctx)
         s->inverse = 1;
 
     pad.type         = AVMEDIA_TYPE_VIDEO;
-    pad.name         = av_strdup("main");
+    pad.name         = "main";
     pad.config_props = config_input;
-    if (!pad.name)
-        return AVERROR(ENOMEM);
 
-    if ((ret = ff_insert_inpad(ctx, 0, &pad)) < 0) {
-        av_freep(&pad.name);
+    if ((ret = ff_insert_inpad(ctx, 0, &pad)) < 0)
         return ret;
-    }
 
     if (!s->inplace) {
         pad.type         = AVMEDIA_TYPE_VIDEO;
-        pad.name         = av_strdup("alpha");
+        pad.name         = "alpha";
         pad.config_props = NULL;
-        if (!pad.name)
-            return AVERROR(ENOMEM);
 
-        if ((ret = ff_insert_inpad(ctx, 1, &pad)) < 0) {
-            av_freep(&pad.name);
+        if ((ret = ff_insert_inpad(ctx, 1, &pad)) < 0)
             return ret;
-        }
     }
 
     return 0;