From ec67c4cbd6b61273c0a6aafa2c0c7a0b491b49b7 Mon Sep 17 00:00:00 2001 From: Nev3r Date: Sat, 24 Nov 2018 23:39:31 +0100 Subject: [PATCH] Fix uninitialized pointer. Signed-off-by: Nev3r --- src/w_wad.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/w_wad.c b/src/w_wad.c index 93722c0bf..958195aac 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -369,7 +369,7 @@ static lumpinfo_t* ResGetLumpsWad (FILE* handle, UINT16* nlmp, const char* filen if (fread(&header, 1, sizeof header, handle) < sizeof header) { CONS_Alert(CONS_ERROR, M_GetText("Can't read wad header because %s\n"), strerror(ferror(handle))); - return 0; + return NULL; } if (memcmp(header.identification, "ZWAD", 4) == 0) @@ -379,7 +379,7 @@ static lumpinfo_t* ResGetLumpsWad (FILE* handle, UINT16* nlmp, const char* filen && memcmp(header.identification, "SDLL", 4) != 0) { CONS_Alert(CONS_ERROR, M_GetText("Invalid WAD header\n")); - return 0; + return NULL; } header.numlumps = LONG(header.numlumps); @@ -393,7 +393,7 @@ static lumpinfo_t* ResGetLumpsWad (FILE* handle, UINT16* nlmp, const char* filen { CONS_Alert(CONS_ERROR, M_GetText("Corrupt wadfile directory (%s)\n"), strerror(ferror(handle))); free(fileinfov); - return 0; + return NULL; } numlumps = header.numlumps; @@ -538,7 +538,7 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp) if (!ResFindSignature(handle, pat_end, max(0, ftell(handle) - (22 + 65536)))) { CONS_Alert(CONS_ERROR, "Missing central directory\n"); - return 0; + return NULL; } fseek(handle, -4, SEEK_CUR); @@ -561,7 +561,7 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp) CONS_Alert(CONS_ERROR, "Central directory is corrupt\n"); Z_Free(lumpinfo); free(zentry); - return 0; + return NULL; } lump_p->position = zentry->offset + zentry->namelen + zentry->xtralen + sizeof(zlentry_t); @@ -624,7 +624,7 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp) UINT16 W_InitFile(const char *filename) { FILE *handle; - lumpinfo_t *lumpinfo; + lumpinfo_t *lumpinfo = NULL; wadfile_t *wadfile; restype_t type; UINT16 numlumps = 0; @@ -709,7 +709,7 @@ UINT16 W_InitFile(const char *filename) CONS_Alert(CONS_ERROR, "Unsupported file format\n"); } - if (lumpinfo == 0) + if (lumpinfo == NULL) { fclose(handle); return INT16_MAX;