mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-23 14:25:34 +00:00
SDL_test_harness: fix memory leak when generated seed
This commit is contained in:
parent
c638b4a682
commit
5d1e6b28d9
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue