diff mbox series

[FFmpeg-devel] fftools/ffmpeg_filter: Fix leak on error

Message ID AS8P250MB07441B3CDCDFA4BD98B3F94E8FEE2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit 62929f40ee7ce1eb2c4b178b98557b7c73f8bc47
Headers show
Series [FFmpeg-devel] fftools/ffmpeg_filter: Fix leak on error | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt May 17, 2024, 7:37 p.m. UTC
Do this by attaching the FilterGraph directly to more permanent
storage from which it will be automatically freed.
Fixes Coverity issue #1596533.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 fftools/ffmpeg_filter.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Andreas Rheinhardt May 19, 2024, 9:20 a.m. UTC | #1
Andreas Rheinhardt:
> Do this by attaching the FilterGraph directly to more permanent
> storage from which it will be automatically freed.
> Fixes Coverity issue #1596533.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  fftools/ffmpeg_filter.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
> index 382d0f75b1..12cca684b4 100644
> --- a/fftools/ffmpeg_filter.c
> +++ b/fftools/ffmpeg_filter.c
> @@ -1198,10 +1198,10 @@ int init_simple_filtergraph(InputStream *ist, OutputStream *ost,
>      FilterGraphPriv *fgp;
>      int ret;
>  
> -    ret = fg_create(&fg, graph_desc, sch);
> +    ret = fg_create(&ost->fg_simple, graph_desc, sch);
>      if (ret < 0)
>          return ret;
> -    ost->fg_simple = fg;
> +    fg  = ost->fg_simple;
>      fgp = fgp_from_fg(fg);
>  
>      fgp->is_simple = 1;

Will apply this patch tomorrow unless there are objections.

- Andreas
diff mbox series

Patch

diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 382d0f75b1..12cca684b4 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -1198,10 +1198,10 @@  int init_simple_filtergraph(InputStream *ist, OutputStream *ost,
     FilterGraphPriv *fgp;
     int ret;
 
-    ret = fg_create(&fg, graph_desc, sch);
+    ret = fg_create(&ost->fg_simple, graph_desc, sch);
     if (ret < 0)
         return ret;
-    ost->fg_simple = fg;
+    fg  = ost->fg_simple;
     fgp = fgp_from_fg(fg);
 
     fgp->is_simple = 1;