diff mbox series

[FFmpeg-devel] avfilter/vf_dedot: Fix leak of AVFrame if making it writable fails

Message ID 20200209184034.29524-1-andreas.rheinhardt@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel] avfilter/vf_dedot: Fix leak of AVFrame if making it writable fails
Related show

Checks

Context Check Description
andriy/ffmpeg-patchwork pending
andriy/ffmpeg-patchwork success Applied patch
andriy/ffmpeg-patchwork success Configure finished
andriy/ffmpeg-patchwork success Make finished
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Andreas Rheinhardt Feb. 9, 2020, 6:40 p.m. UTC
Even in this scenario, the frame still contains references to data that
won't be freed if the frame isn't unreferenced. And the AVFrame itself
will leak, too.

Fixes Coverity issue #1441422.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavfilter/vf_dedot.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Paul B Mahol Feb. 9, 2020, 9:56 p.m. UTC | #1
lgtm

On 2/9/20, Andreas Rheinhardt <andreas.rheinhardt@gmail.com> wrote:
> Even in this scenario, the frame still contains references to data that
> won't be freed if the frame isn't unreferenced. And the AVFrame itself
> will leak, too.
>
> Fixes Coverity issue #1441422.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavfilter/vf_dedot.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libavfilter/vf_dedot.c b/libavfilter/vf_dedot.c
> index 1fb7bfe866..993ac8f74f 100644
> --- a/libavfilter/vf_dedot.c
> +++ b/libavfilter/vf_dedot.c
> @@ -313,7 +313,8 @@ static int activate(AVFilterContext *ctx)
>                                                 FFMIN(s->planeheight[2],
>
> ff_filter_get_nb_threads(ctx)));
>                      }
> -                }
> +                } else
> +                    av_frame_free(&out);
>              } else if (!out) {
>                  ret = AVERROR(ENOMEM);
>              }
> --
> 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".
Michael Niedermayer Feb. 10, 2020, 11:03 p.m. UTC | #2
On Sun, Feb 09, 2020 at 10:56:03PM +0100, Paul B Mahol wrote:
> lgtm

will apply

thx

[...]
diff mbox series

Patch

diff --git a/libavfilter/vf_dedot.c b/libavfilter/vf_dedot.c
index 1fb7bfe866..993ac8f74f 100644
--- a/libavfilter/vf_dedot.c
+++ b/libavfilter/vf_dedot.c
@@ -313,7 +313,8 @@  static int activate(AVFilterContext *ctx)
                                                FFMIN(s->planeheight[2],
                                                ff_filter_get_nb_threads(ctx)));
                     }
-                }
+                } else
+                    av_frame_free(&out);
             } else if (!out) {
                 ret = AVERROR(ENOMEM);
             }