mirror of https://github.com/encounter/SDL.git
testautomation: fix use-after-free when restoring hint value
This commit is contained in:
parent
704edf6323
commit
f124259e59
|
@ -114,6 +114,9 @@ hints_setHint(void *arg)
|
|||
originalValue = (char *)SDL_GetHint((char*)_HintsEnum[i]);
|
||||
SDLTest_AssertPass("Call to SDL_GetHint(%s)", (char*)_HintsEnum[i]);
|
||||
|
||||
/* Copy the original value, since it will be freed when we set it again */
|
||||
originalValue = originalValue ? SDL_strdup(originalValue) : NULL;
|
||||
|
||||
/* Set value (twice) */
|
||||
for (j=1; j<=2; j++) {
|
||||
result = SDL_SetHint((char*)_HintsEnum[i], value);
|
||||
|
@ -138,6 +141,7 @@ hints_setHint(void *arg)
|
|||
result == SDL_TRUE || result == SDL_FALSE,
|
||||
"Verify valid result was returned, got: %i",
|
||||
(int)result);
|
||||
SDL_free(originalValue);
|
||||
}
|
||||
|
||||
SDL_free(value);
|
||||
|
|
Loading…
Reference in New Issue