mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-06 11:28:15 +00:00
src/io/SDL_asyncio.c:SDL_AsyncIOFromFile(): Fix null-dereference warning
This commit is contained in:

committed by
Sam Lantinga

parent
8bfde6755e
commit
ad11c6988c
@@ -57,13 +57,15 @@ SDL_AsyncIO *SDL_AsyncIOFromFile(const char *file, const char *mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SDL_AsyncIO *asyncio = (SDL_AsyncIO *)SDL_calloc(1, sizeof(*asyncio));
|
SDL_AsyncIO *asyncio = (SDL_AsyncIO *)SDL_calloc(1, sizeof(*asyncio));
|
||||||
if (asyncio) {
|
if (!asyncio) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
asyncio->lock = SDL_CreateMutex();
|
asyncio->lock = SDL_CreateMutex();
|
||||||
if (!asyncio->lock) {
|
if (!asyncio->lock) {
|
||||||
SDL_free(asyncio);
|
SDL_free(asyncio);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!SDL_SYS_AsyncIOFromFile(file, binary_mode, asyncio)) {
|
if (!SDL_SYS_AsyncIOFromFile(file, binary_mode, asyncio)) {
|
||||||
SDL_DestroyMutex(asyncio->lock);
|
SDL_DestroyMutex(asyncio->lock);
|
||||||
|
Reference in New Issue
Block a user