While debugging a crash, I came across this issue in some code:
int func()
{
char *p1 = malloc(...);
if (p1 == NULL)
goto err_exit;
char
This is not a bug in gcc. A jump is just a jump in C. There is no special logic applied. The issue is that you are not initializing your pointers to NULL
first. If you were to do that then you free call would be free(NULL)
which would not crash. Start the function with char *p1 = NULL, *p2 = NULL;
and all will be well.