I found the culprit
int in = (*blockPtr).count;
for(;in > (*blockPtr).count - l + index; in--)
{
((void **)(*blockPtr).array)[in] = ((void **)(*blockPtr).array)[in-1];
}
here i shift all elements to the right in a non-full array that fall past a target index within that array.
However, i left out the following line which is meant to assign the target index with a new pointer value in order to perform an "insertion" operation.
((void **)(*blockPtr).array)[in] = newptr;
since i did not reassign that index, i had two indices pointing to the same position in memory which caused me to double free a spot in memory. Hopefully my mistake will help someone else fix theirs.
Last edited by trapfether; 09-12-2014 at 02:41 PM.
|