Fixed double free when loading 24b image.
Yves, it is not needed to check if a pointer is NULL before freeing it, free(NULL) is okay and will not crash. However, each time you free something, you should put it back to NULL : -It makes sure the program will crash on next access to it (even if the memory chunk is reallocated) -It makes it easier to debug things, a NULL pointer is freed data. If you can't gt used to it, create a Free macro that does the NULLification for you... git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1259 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
c1800bb42d
commit
b62f86bf45
@ -692,6 +692,7 @@ void Load_image(T_IO_Context *context)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(context->Buffer_image_24b);
|
free(context->Buffer_image_24b);
|
||||||
|
context->Buffer_image_24b = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context->Type == CONTEXT_MAIN_IMAGE)
|
if (context->Type == CONTEXT_MAIN_IMAGE)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user