Bladeren bron

test/testautomation_intrinsics.c: Free variables before returning

Petar Popovic 2 maanden geleden
bovenliggende
commit
831fc70923
1 gewijzigde bestanden met toevoegingen van 12 en 0 verwijderingen
  1. 12 0
      test/testautomation_intrinsics.c

+ 12 - 0
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);