mirror of
https://github.com/encounter/SDL.git
synced 2025-07-10 07:05:52 +00:00
Handle potential out of memory condition when working with hints
This commit is contained in:
parent
145824f6ab
commit
ba62ead5ec
@ -178,6 +178,11 @@ SDL_AddHintCallback(const char *name, SDL_HintCallback callback, void *userdata)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
hint->name = SDL_strdup(name);
|
hint->name = SDL_strdup(name);
|
||||||
|
if (!hint->name) {
|
||||||
|
SDL_free(hint);
|
||||||
|
SDL_OutOfMemory();
|
||||||
|
return;
|
||||||
|
}
|
||||||
hint->value = NULL;
|
hint->value = NULL;
|
||||||
hint->priority = SDL_HINT_DEFAULT;
|
hint->priority = SDL_HINT_DEFAULT;
|
||||||
hint->callbacks = NULL;
|
hint->callbacks = NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user