mirror of
				https://github.com/Ryujinx/SDL.git
				synced 2025-11-04 15:14:56 +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 testSkippedCount = 0;
 | 
				
			||||||
    int countSum = 0;
 | 
					    int countSum = 0;
 | 
				
			||||||
    const SDLTest_TestCaseReference **failedTests;
 | 
					    const SDLTest_TestCaseReference **failedTests;
 | 
				
			||||||
 | 
					    char generatedSeed[16 + 1];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Sanitize test iterations */
 | 
					    /* Sanitize test iterations */
 | 
				
			||||||
    if (testIterations < 1) {
 | 
					    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 */
 | 
					    /* Generate run see if we don't have one already */
 | 
				
			||||||
    if (userRunSeed == NULL || userRunSeed[0] == '\0') {
 | 
					    if (userRunSeed == NULL || userRunSeed[0] == '\0') {
 | 
				
			||||||
        runSeed = SDLTest_GenerateRunSeed(16);
 | 
					        char *tmp = SDLTest_GenerateRunSeed(16);
 | 
				
			||||||
        if (runSeed == NULL) {
 | 
					        if (tmp == NULL) {
 | 
				
			||||||
            SDLTest_LogError("Generating a random seed failed");
 | 
					            SDLTest_LogError("Generating a random seed failed");
 | 
				
			||||||
            return 2;
 | 
					            return 2;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        SDL_memcpy(generatedSeed, tmp, 16 + 1);
 | 
				
			||||||
 | 
					        SDL_free(tmp);
 | 
				
			||||||
 | 
					        runSeed = generatedSeed;
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        runSeed = userRunSeed;
 | 
					        runSeed = userRunSeed;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue