-No need to check if a pointer is null before freeing it.

-However if the pointer is still living (for example a global) you should assign NULL to it to avoid bad ram access and random bugs. Accessing a NULL pointer always  gives a segfault, accessing a freed pointer may or may not crash.
-Also fixed a memory leak


git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@924 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Adrien Destugues
2009-07-16 07:33:14 +00:00
parent 8b5681eccb
commit 07bfc119b8
3 changed files with 14 additions and 18 deletions

View File

@@ -5483,8 +5483,8 @@ void Load_PC1(void)
else
{
File_error=1;
if (bufferdecomp) free(bufferdecomp);
if (buffercomp) free(buffercomp);
free(bufferdecomp);
free(buffercomp);
}
fclose(file);
}