More incorrect/inconsistent frees

This commit is contained in:
toaster 2023-01-04 14:21:10 +00:00
parent 5c51ad77f6
commit 2786c2095e
2 changed files with 3 additions and 6 deletions

View file

@ -300,8 +300,7 @@ void PR_LoadProfiles(void)
if (strcmp(srb2home,"."))
gdfolder = srb2home;
Z_Free(save.buffer);
save.p = NULL;
P_SaveBufferFree(&save);
I_Error("Not a valid Profile file.\nDelete %s (maybe in %s) and try again.", PROFILESFILE, gdfolder);
}
save.p += headerlen;
@ -309,8 +308,7 @@ void PR_LoadProfiles(void)
version = READUINT8(save.p);
if (version > PROFILEVER)
{
Z_Free(save.buffer);
save.p = NULL;
P_SaveBufferFree(&save);
I_Error("Existing %s is from the future! (expected %d, got %d)", PROFILESFILE, PROFILEVER, version);
}

View file

@ -749,8 +749,7 @@ void P_WriteThings(void)
filename = va("newthings-%s.lmp", G_BuildMapName(gamemap));
FIL_WriteFile(filename, save.buffer, length);
free(save.buffer);
save.p = NULL;
P_SaveBufferFree(&save);
CONS_Printf(M_GetText("%s saved.\n"), filename);
}