Quellcode durchsuchen

Fixed possible memset(NULL) call in testautomation's SDL_aligned_alloc() check

Fixes https://github.com/libsdl-org/SDL/issues/11144
Sam Lantinga vor 6 Monaten
Ursprung
Commit
8262072d91
1 geänderte Dateien mit 5 neuen und 3 gelöschten Zeilen
  1. 5 3
      test/testautomation_stdlib.c

+ 5 - 3
test/testautomation_stdlib.c

@@ -913,9 +913,11 @@ static int SDLCALL stdlib_aligned_alloc(void *arg)
         }
         SDLTest_AssertCheck(ptr != NULL, "Check output, expected non-NULL, got: %p", ptr);
         SDLTest_AssertCheck((((size_t)ptr) % alignment) == 0, "Check output, expected aligned pointer, actual offset: %"SIZE_FORMAT, (((size_t)ptr) % alignment));
-        SDLTest_AssertPass("Filling memory to alignment value");
-        SDL_memset(ptr, 0xAA, alignment);
-        SDL_aligned_free(ptr);
+        if (ptr != NULL) {
+            SDLTest_AssertPass("Filling memory to alignment value");
+            SDL_memset(ptr, 0xAA, alignment);
+            SDL_aligned_free(ptr);
+        }
     }
 
     return TEST_COMPLETED;