2 ms·
I can think of one case in a project where we allocate a 4K block, fill the first n bytes with header info, and then add n bytes to the pointer and return it to
by SamReidHughes 15y ago
I can think of one case in a project where we allocate a 4K block, fill the first n bytes with header info, and then add n bytes to the pointer and return it to something that's told it's getting a 4K - n byte block.
And then later it passes that return value to some function that deallocates the block, by calling free(((char *)p) - n).