[FFmpeg-cvslog] tests/audiomatch: add free to make static analysis tools happy

Jun Zhao git at videolan.org
Thu Dec 10 13:43:19 EET 2020


ffmpeg | branch: master | Jun Zhao <barryjzhao at tencent.com> | Mon Dec  7 15:47:09 2020 +0800| [412c3b37a410c90820bb37308ed55df5aa75e2cc] | committer: Jun Zhao

tests/audiomatch: add free to make static analysis tools happy

Reviewed-by: Anton Khirnov <anton at khirnov.net>
Signed-off-by: Jun Zhao <barryjzhao at tencent.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=412c3b37a410c90820bb37308ed55df5aa75e2cc
---

 tests/audiomatch.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/tests/audiomatch.c b/tests/audiomatch.c
index bb9deca624..56a60bdecf 100644
--- a/tests/audiomatch.c
+++ b/tests/audiomatch.c
@@ -82,9 +82,9 @@ int main(int argc, char **argv) {
     signal = malloc(siglen * sizeof(*signal));
 
     if (fread(data  , 1, datlen, f[0]) != datlen)
-        return 1;
+        goto read_fail;
     if (fread(signal, 1, siglen, f[1]) != siglen)
-        return 1;
+        goto read_fail;
     datlen /= 2;
     siglen /= 2;
 
@@ -111,5 +111,12 @@ int main(int argc, char **argv) {
     }
     printf("presig: %d postsig:%d c:%7.4f lenerr:%d\n", bestpos, datlen - siglen - bestpos, bestc / sigamp, datlen - siglen);
 
+    free(data);
+    free(signal);
     return 0;
+
+read_fail:
+    free(data);
+    free(signal);
+    return 1;
 }



More information about the ffmpeg-cvslog mailing list