diff mbox

[FFmpeg-devel,7/9] avfilter/vf_premultiply: fix memory-leak on failure

Message ID 20171108181753.6776-8-timo@rothenpieler.org
State Accepted
Commit c7ded42d5dfc0124008b5b9b13a1a342324885ed
Headers show

Commit Message

Timo Rothenpieler Nov. 8, 2017, 6:17 p.m. UTC
Fixes CID #1416352
---
 libavfilter/vf_premultiply.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Paul B Mahol Nov. 8, 2017, 7:03 p.m. UTC | #1
On 11/8/17, Timo Rothenpieler <timo@rothenpieler.org> wrote:
> Fixes CID #1416352
> ---
>  libavfilter/vf_premultiply.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/libavfilter/vf_premultiply.c b/libavfilter/vf_premultiply.c
> index 1af6433bc9..4b6abc6e73 100644
> --- a/libavfilter/vf_premultiply.c
> +++ b/libavfilter/vf_premultiply.c
> @@ -609,9 +609,10 @@ static int activate(AVFilterContext *ctx)
>          int64_t pts;
>
>          if ((ret = ff_inlink_consume_frame(ctx->inputs[0], &frame)) > 0) {
> -            if ((ret = filter_frame(ctx, &out, frame, frame)) < 0)
> -                return ret;
> +            ret = filter_frame(ctx, &out, frame, frame);
>              av_frame_free(&frame);
> +            if (ret < 0)
> +                return ret;
>              ret = ff_filter_frame(ctx->outputs[0], out);
>          }
>          if (ret < 0) {
> --
> 2.14.2
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

ok
Timo Rothenpieler Nov. 13, 2017, 7:51 p.m. UTC | #2
applied
diff mbox

Patch

diff --git a/libavfilter/vf_premultiply.c b/libavfilter/vf_premultiply.c
index 1af6433bc9..4b6abc6e73 100644
--- a/libavfilter/vf_premultiply.c
+++ b/libavfilter/vf_premultiply.c
@@ -609,9 +609,10 @@  static int activate(AVFilterContext *ctx)
         int64_t pts;
 
         if ((ret = ff_inlink_consume_frame(ctx->inputs[0], &frame)) > 0) {
-            if ((ret = filter_frame(ctx, &out, frame, frame)) < 0)
-                return ret;
+            ret = filter_frame(ctx, &out, frame, frame);
             av_frame_free(&frame);
+            if (ret < 0)
+                return ret;
             ret = ff_filter_frame(ctx->outputs[0], out);
         }
         if (ret < 0) {