Skip to content

Commit

Permalink
src/io/SDL_asyncio.c:SDL_AsyncIOFromFile(): Fix null-dereference warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Sackzement authored and slouken committed Feb 23, 2025
1 parent 8bfde67 commit ad11c69
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/io/SDL_asyncio.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,14 @@ SDL_AsyncIO *SDL_AsyncIOFromFile(const char *file, const char *mode)
}

SDL_AsyncIO *asyncio = (SDL_AsyncIO *)SDL_calloc(1, sizeof(*asyncio));
if (asyncio) {
asyncio->lock = SDL_CreateMutex();
if (!asyncio->lock) {
SDL_free(asyncio);
return NULL;
}
if (!asyncio) {
return NULL;
}

asyncio->lock = SDL_CreateMutex();
if (!asyncio->lock) {
SDL_free(asyncio);
return NULL;
}

if (!SDL_SYS_AsyncIOFromFile(file, binary_mode, asyncio)) {
Expand Down

0 comments on commit ad11c69

Please sign in to comment.