diff mbox series

[FFmpeg-devel,1/6] avfilter/vf_tiltandshift: Free dst on error

Message ID 20240710225012.691594-1-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/6] avfilter/vf_tiltandshift: Free dst on error | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer July 10, 2024, 10:50 p.m. UTC
Fixes: CID1559901 Resource leak

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavfilter/vf_tiltandshift.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Vittorio Giovara July 11, 2024, 10:19 p.m. UTC | #1
On Thu, Jul 11, 2024 at 12:50 AM Michael Niedermayer <michael@niedermayer.cc>
wrote:

> Fixes: CID1559901 Resource leak
>
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavfilter/vf_tiltandshift.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/libavfilter/vf_tiltandshift.c b/libavfilter/vf_tiltandshift.c
> index b49a713339d..08bcb062473 100644
> --- a/libavfilter/vf_tiltandshift.c
> +++ b/libavfilter/vf_tiltandshift.c
> @@ -237,8 +237,10 @@ static int output_frame(AVFilterLink *outlink)
>
>      // set correct timestamps and props as long as there is proper input
>      ret = av_frame_copy_props(dst, s->input);
> -    if (ret < 0)
> +    if (ret < 0) {
> +        av_frame_free(&dst);
>          return ret;
> +    }
>
>      // discard frame at the top of the list since it has been fully
> processed
>      list_remove_head(s);
> --
>

lgtm
Michael Niedermayer July 12, 2024, 7:59 p.m. UTC | #2
On Fri, Jul 12, 2024 at 12:19:29AM +0200, Vittorio Giovara wrote:
> On Thu, Jul 11, 2024 at 12:50 AM Michael Niedermayer <michael@niedermayer.cc>
> wrote:
> 
> > Fixes: CID1559901 Resource leak
> >
> > Sponsored-by: Sovereign Tech Fund
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavfilter/vf_tiltandshift.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavfilter/vf_tiltandshift.c b/libavfilter/vf_tiltandshift.c
> > index b49a713339d..08bcb062473 100644
> > --- a/libavfilter/vf_tiltandshift.c
> > +++ b/libavfilter/vf_tiltandshift.c
> > @@ -237,8 +237,10 @@ static int output_frame(AVFilterLink *outlink)
> >
> >      // set correct timestamps and props as long as there is proper input
> >      ret = av_frame_copy_props(dst, s->input);
> > -    if (ret < 0)
> > +    if (ret < 0) {
> > +        av_frame_free(&dst);
> >          return ret;
> > +    }
> >
> >      // discard frame at the top of the list since it has been fully
> > processed
> >      list_remove_head(s);
> > --
> >
> 
> lgtm

will apply

thx

[...]
diff mbox series

Patch

diff --git a/libavfilter/vf_tiltandshift.c b/libavfilter/vf_tiltandshift.c
index b49a713339d..08bcb062473 100644
--- a/libavfilter/vf_tiltandshift.c
+++ b/libavfilter/vf_tiltandshift.c
@@ -237,8 +237,10 @@  static int output_frame(AVFilterLink *outlink)
 
     // set correct timestamps and props as long as there is proper input
     ret = av_frame_copy_props(dst, s->input);
-    if (ret < 0)
+    if (ret < 0) {
+        av_frame_free(&dst);
         return ret;
+    }
 
     // discard frame at the top of the list since it has been fully processed
     list_remove_head(s);