Re: crash in malloc() ? -
08-04-2004
Just a quick look-over your code I see some pretty serious errors...
Always do a null pointer check on anything you allocate.
Always free any memory you allocate ( make sure the pointer is not null though ).
I don't know what MAX_PATH_INDEX is but you are trying to index an array with only one element.
If you look at your malloc line, you are allocating memory for one path object only. If you wan't to allocate several of them use this... malloc ( sizeof( type ) * elements );
This is typed in a hurry but try fixing those mistakes and see if the crash goes away.
|