snake: check allocated memory before use

This commit is contained in:
Anonymous Maarten 2024-10-24 23:53:44 +02:00 committed by Anonymous Maarten
parent 20e01c6fbe
commit 590e1196d0
1 changed files with 3 additions and 0 deletions

View File

@ -310,6 +310,9 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
}
AppState *as = SDL_calloc(1, sizeof(AppState));
if (!as) {
return SDL_APP_FAILURE;
}
*appstate = as;