SDL_test_harness: fix memory leak when generated seed
diff --git a/src/test/SDL_test_harness.c b/src/test/SDL_test_harness.c
index 7c8201f..e6ae3ce 100644
--- a/src/test/SDL_test_harness.c
+++ b/src/test/SDL_test_harness.c
@@ -395,6 +395,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
int testSkippedCount = 0;
int countSum = 0;
const SDLTest_TestCaseReference **failedTests;
+ char generatedSeed[16 + 1];
/* Sanitize test iterations */
if (testIterations < 1) {
@@ -403,11 +404,14 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
/* Generate run see if we don't have one already */
if (userRunSeed == NULL || userRunSeed[0] == '\0') {
- runSeed = SDLTest_GenerateRunSeed(16);
- if (runSeed == NULL) {
+ char *tmp = SDLTest_GenerateRunSeed(16);
+ if (tmp == NULL) {
SDLTest_LogError("Generating a random seed failed");
return 2;
}
+ SDL_memcpy(generatedSeed, tmp, 16 + 1);
+ SDL_free(tmp);
+ runSeed = generatedSeed;
} else {
runSeed = userRunSeed;
}