Are you trying to compile and run on OS X?
This is a typical problem of dynamically malloc'd memory in Mac OS X. Normally, malloc() will return a pointer to a 16-byte aligned memory pointer if the requested amount of memory is larger than 16 bytes. However, strdup does not.
You should consider in your album struct, instead of having char * for each element, putting the actual character arrays there. That memory will be allocated with the original malloc() called for your cd pointer. This will eliminate the need to go free each individual strdup()'s memory, and will get rid of your non-aligned pointer issue. If you have further questions, post your header file with your struct and I'll show you the modifications to make this easier
Main Topics
Browse All Topics





by: Infinity08Posted on 2009-07-23 at 11:15:49ID: 24928285
>> album *cd = malloc(records*(sizeof(cd) ));
um)));
I assume that was supposed to be :
album *cd = malloc(records*(sizeof(alb
instead ?