0xC0000005:Access Violation error when using malloc.
Posted on 2003-11-06
I am experiencing this strange problem which I have never come across before. Please see the code snippet below:
PIXEL is a strucutre which al has a pointer pointing to itself.
The problem I am facing is I am getting an access violation error when executing this statement. I traced the problem to the function __sbh_alloc_block (int intSize) line number 621 in the file sbheap.c Please see the statement below :
// unlink entry from list
pEntry->pEntryPrev->pEntryNext = pEntry->pEntryNext;
I really dont know whats causing this errror. Even malloc() is not returning a NULL value so I think its not really related to insufficient memory. Looks like the program is trying to allocate a corrupted memory block, but I cant figure exactly what the problem is. Also, just before the call to malloc, I am incrementing a long int variable. Everytime the value is 13. I have already wasted 2 days over this problem. It will be really helpful for me if anybody can throw some light on this. You can also send comments/suggestion/solution on firstname.lastname@example.org
Thanks and best regards.