diff mbox series

[FFmpeg-devel,v3,1/2] fate/imf: fix memory leak

Message ID 20230515183300.7252-1-pal@sandflow.com
State Accepted
Commit dbe43bca25b84f2c2f5f713eeff5ab2dae89fc25
Headers show
Series [FFmpeg-devel,v3,1/2] fate/imf: fix memory leak | 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

Pierre-Anthony Lemieux May 15, 2023, 6:32 p.m. UTC
From: Pierre-Anthony Lemieux <pal@palemieux.com>

---
 libavformat/tests/imf.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Comments

Pierre-Anthony Lemieux May 18, 2023, 10:16 p.m. UTC | #1
Will apply shortly.

On Mon, May 15, 2023 at 11:33 AM <pal@sandflow.com> wrote:
>
> From: Pierre-Anthony Lemieux <pal@palemieux.com>
>
> ---
>  libavformat/tests/imf.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/tests/imf.c b/libavformat/tests/imf.c
> index cfd84fb8c8..c02cd87ceb 100644
> --- a/libavformat/tests/imf.c
> +++ b/libavformat/tests/imf.c
> @@ -402,6 +402,9 @@ static int test_bad_cpl_parsing(FFIMFCPL **cpl)
>          return ret;
>      }
>
> +    ff_imf_cpl_free(*cpl);
> +    *cpl = NULL;
> +
>      return 0;
>  }
>
> @@ -423,6 +426,9 @@ static int test_bad_resource_cpl_parsing(FFIMFCPL **cpl)
>          return ret;
>      }
>
> +    ff_imf_cpl_free(*cpl);
> +    *cpl = NULL;
> +
>      return 0;
>  }
>
> @@ -594,8 +600,11 @@ int main(int argc, char *argv[])
>      printf("#### End failing test ####\n");
>
>      printf("#### The following should emit errors ####\n");
> -    if (test_bad_resource_cpl_parsing(&cpl) != 0)
> +    if (test_bad_resource_cpl_parsing(&cpl) != 0) {
> +        if (cpl)
> +            printf("Improper cleanup after failed CPL parsing\n");
>          ret = 1;
> +    }
>      printf("#### End emission of errors ####\n");
>
>      return ret;
> --
> 2.25.1
>
diff mbox series

Patch

diff --git a/libavformat/tests/imf.c b/libavformat/tests/imf.c
index cfd84fb8c8..c02cd87ceb 100644
--- a/libavformat/tests/imf.c
+++ b/libavformat/tests/imf.c
@@ -402,6 +402,9 @@  static int test_bad_cpl_parsing(FFIMFCPL **cpl)
         return ret;
     }
 
+    ff_imf_cpl_free(*cpl);
+    *cpl = NULL;
+
     return 0;
 }
 
@@ -423,6 +426,9 @@  static int test_bad_resource_cpl_parsing(FFIMFCPL **cpl)
         return ret;
     }
 
+    ff_imf_cpl_free(*cpl);
+    *cpl = NULL;
+
     return 0;
 }
 
@@ -594,8 +600,11 @@  int main(int argc, char *argv[])
     printf("#### End failing test ####\n");
 
     printf("#### The following should emit errors ####\n");
-    if (test_bad_resource_cpl_parsing(&cpl) != 0)
+    if (test_bad_resource_cpl_parsing(&cpl) != 0) {
+        if (cpl)
+            printf("Improper cleanup after failed CPL parsing\n");
         ret = 1;
+    }
     printf("#### End emission of errors ####\n");
 
     return ret;