This bit of C code is giving segmentation error in gdb
if ((seq_entry_action=malloc((seq_subphases)*sizeof(int*)))==NULL){
printf("Cannot allocate memory for seq_entry_action\n");
}
where:
int **seq_entry_action=NULL;
unsigned int seq_subphases=0;
At the time of executing, and If I add a breakpoint in gdb just before this snippet of code (it's just another printf() statement) , the values are
(gdb) p seq_subphases
$3 = 88
(gdb) p seq_entry_action
$4 = (int **) 0x0
then I press next and it segfaults at malloc
I really don't get it.....
it was like that indeed... an earlier malloc of wrongly computed sizeof() was the reason this malloc failed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With