User forums > Help
Problem when debugging piece of code while execution works
rcoll:
Killerbot is correct, he is not allocating enough memory to **s.
Change that first allocation to from
s = (unsigned char**)malloc(MAX);
to
s = (unsigned char**)malloc(MAX * sizeof(char *));
and then run it again.
-- Ron --
Game_Ender:
--- Quote from: rcoll on August 09, 2006, 07:18:17 pm ---s = (unsigned char**)malloc(MAX * sizeof(char *));
and then run it again.
-- Ron --
--- End quote ---
You have better eyes than I Ron and I guess you trust you instincts and not listen to me sethjackson ;). I should of checked more carefully.
I have made the mistake of not even allocating the space for the pointers first, or doing only the pointers and not the elements and that was the main thing I was checking. Of course a backtrace from the debugger is usually more helpful than starting at the code just hoping the error will pop out at you. It should of failed trying to write the 3rd test message.
sethjackson:
--- Quote from: Game_Ender on August 09, 2006, 07:52:55 pm ---
--- Quote from: rcoll on August 09, 2006, 07:18:17 pm ---s = (unsigned char**)malloc(MAX * sizeof(char *));
and then run it again.
-- Ron --
--- End quote ---
You have better eyes than I Ron and I guess you trust you instincts and not listen to me sethjackson ;). I should of checked more carefully.
I have made the mistake of not even allocating the space for the pointers first, or doing only the pointers and not the elements and that was the main thing I was checking. Of course a backtrace from the debugger is usually more helpful than starting at the code just hoping the error will pop out at you. It should of failed trying to write the 3rd test message.
--- End quote ---
Umm what do you mean by "I guess you trust you instincts and not listen to me sethjackson ;)"?
rcoll:
--- Quote from: sethjackson on August 09, 2006, 08:12:17 pm ---
Umm what do you mean by "I guess you trust you instincts and not listen to me sethjackson ;)"?
--- End quote ---
Will the real "sethjackson" please stand up? :P
-- Ron --
rcoll:
--- Quote from: Game_Ender on August 09, 2006, 07:52:55 pm ---
--- Quote from: rcoll on August 09, 2006, 07:18:17 pm ---s = (unsigned char**)malloc(MAX * sizeof(char *));
and then run it again.
-- Ron --
--- End quote ---
You have better eyes than I Ron and I guess you trust you instincts and not listen to me sethjackson ;). I should of checked more carefully.
I have made the mistake of not even allocating the space for the pointers first, or doing only the pointers and not the elements and that was the main thing I was checking. Of course a backtrace from the debugger is usually more helpful than starting at the code just hoping the error will pop out at you. It should of failed trying to write the 3rd test message.
--- End quote ---
Actually "Killerbot" found it first, I just expounded on it.
Cheers,
Ron
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version