Commit 0a91a793cfc5a6aa650e00ebfedbc43c05e723aa

Sylvain 2022-12-02T21:11:33

Fix Conditional jump or move depends on uninitialised value(s) eg ./testsprite2 --trackmem

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/src/test/SDL_test_memory.c b/src/test/SDL_test_memory.c
index 7cf707d..4963dea 100644
--- a/src/test/SDL_test_memory.c
+++ b/src/test/SDL_test_memory.c
@@ -233,6 +233,12 @@ void SDLTest_LogAllocations()
         return;
     }
 
+    message = SDL_realloc_orig(NULL, 1);
+    if (!message) {
+        return;
+    }
+    *message = 0;
+
 #define ADD_LINE()                                         \
     message_size += (SDL_strlen(line) + 1);                \
     tmp = (char *)SDL_realloc_orig(message, message_size); \