SDL: test/testautomation_intrinsics.c: Free variables before returning

From 831fc70923eefb90bb37b2ed69e40cab47e5da39 Mon Sep 17 00:00:00 2001
From: Petar Popovic <[EMAIL REDACTED]>
Date: Sun, 16 Feb 2025 06:39:54 +0100
Subject: [PATCH] test/testautomation_intrinsics.c: Free variables before
 returning

---
 test/testautomation_intrinsics.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/test/testautomation_intrinsics.c b/test/testautomation_intrinsics.c
index 4b9cb65cd20bf..8338d33d35ff5 100644
--- a/test/testautomation_intrinsics.c
+++ b/test/testautomation_intrinsics.c
@@ -323,6 +323,7 @@ static int SDLCALL intrinsics_selftest(void *arg)
         size_t size;
         Uint32 *dest, *a, *b;
         if (allocate_random_uint_arrays(&dest, &a, &b, &size) < 0) {
+            free_arrays(dest, a, b);
             return TEST_ABORTED;
         }
         kernel_uints_mul_cpu(dest, a, b, size);
@@ -333,6 +334,7 @@ static int SDLCALL intrinsics_selftest(void *arg)
         size_t size;
         Uint32 *dest, *a, *b;
         if (allocate_random_uint_arrays(&dest, &a, &b, &size) < 0) {
+            free_arrays(dest, a, b);
             return TEST_ABORTED;
         }
         kernel_uints_add_cpu(dest, a, b, size);
@@ -343,6 +345,7 @@ static int SDLCALL intrinsics_selftest(void *arg)
         size_t size;
         float *dest, *a, *b;
         if (allocate_random_float_arrays(&dest, &a, &b, &size) < 0) {
+            free_arrays(dest, a, b);
             return TEST_ABORTED;
         }
         kernel_floats_add_cpu(dest, a, b, size);
@@ -353,6 +356,7 @@ static int SDLCALL intrinsics_selftest(void *arg)
         size_t size;
         double *dest, *a, *b;
         if (allocate_random_double_arrays(&dest, &a, &b, &size) < 0) {
+            free_arrays(dest, a, b);
             return TEST_ABORTED;
         }
         kernel_doubles_add_cpu(dest, a, b, size);
@@ -373,6 +377,7 @@ static int SDLCALL intrinsics_testMMX(void *arg)
 
             SDLTest_AssertCheck(true, "Test executable uses MMX intrinsics.");
             if (allocate_random_uint_arrays(&dest, &a, &b, &size) < 0) {
+                free_arrays(dest, a, b);
                 return TEST_ABORTED;
             }
             kernel_uints_add_mmx(dest, a, b, size);
@@ -401,6 +406,7 @@ static int SDLCALL intrinsics_testSSE(void *arg)
 
             SDLTest_AssertCheck(true, "Test executable uses SSE intrinsics.");
             if (allocate_random_float_arrays(&dest, &a, &b, &size) < 0) {
+                free_arrays(dest, a, b);
                 return TEST_ABORTED;
             }
             kernel_floats_add_sse(dest, a, b, size);
@@ -429,6 +435,7 @@ static int SDLCALL intrinsics_testSSE2(void *arg)
 
             SDLTest_AssertCheck(true, "Test executable uses SSE2 intrinsics.");
             if (allocate_random_double_arrays(&dest, &a, &b, &size) < 0) {
+                free_arrays(dest, a, b);
                 return TEST_ABORTED;
             }
             kernel_doubles_add_sse2(dest, a, b, size);
@@ -457,6 +464,7 @@ static int SDLCALL intrinsics_testSSE3(void *arg)
 
             SDLTest_AssertCheck(true, "Test executable uses SSE3 intrinsics.");
             if (allocate_random_uint_arrays(&dest, &a, &b, &size) < 0) {
+                free_arrays(dest, a, b);
                 return TEST_ABORTED;
             }
             kernel_uints_add_sse3(dest, a, b, size);
@@ -485,6 +493,7 @@ static int SDLCALL intrinsics_testSSE4_1(void *arg)
 
             SDLTest_AssertCheck(true, "Test executable uses SSE4.1 intrinsics.");
             if (allocate_random_uint_arrays(&dest, &a, &b, &size) < 0) {
+                free_arrays(dest, a, b);
                 return TEST_ABORTED;
             }
             kernel_uints_mul_sse4_1(dest, a, b, size);
@@ -548,6 +557,7 @@ static int SDLCALL intrinsics_testAVX(void *arg)
 
             SDLTest_AssertCheck(true, "Test executable uses AVX intrinsics.");
             if (allocate_random_float_arrays(&dest, &a, &b, &size) < 0) {
+                free_arrays(dest, a, b);
                 return TEST_ABORTED;
             }
             kernel_floats_add_avx(dest, a, b, size);
@@ -576,6 +586,7 @@ static int SDLCALL intrinsics_testAVX2(void *arg)
 
             SDLTest_AssertCheck(true, "Test executable uses AVX2 intrinsics.");
             if (allocate_random_uint_arrays(&dest, &a, &b, &size) < 0) {
+                free_arrays(dest, a, b);
                 return TEST_ABORTED;
             }
             kernel_uints_add_avx2(dest, a, b, size);
@@ -604,6 +615,7 @@ static int SDLCALL intrinsics_testAVX512F(void *arg)
 
             SDLTest_AssertCheck(true, "Test executable uses AVX512F intrinsics.");
             if (allocate_random_float_arrays(&dest, &a, &b, &size) < 0) {
+                free_arrays(dest, a, b);
                 return TEST_ABORTED;
             }
             kernel_floats_add_avx512f(dest, a, b, size);