objectpool icon indicating copy to clipboard operation
objectpool copied to clipboard

the realloc may change pointer

Open wiltchamberian opened this issue 3 years ago • 1 comments

you use realloc to add block ,but realloc may return a pointer different from the previous, if this happen, all the allocated object pointer will be invalid. this is a serious issue. so i advise not to use realloc, but alloc a new chunk, then use lists to connect the chunks.

wiltchamberian avatar May 12 '22 14:05 wiltchamberian

It's been a while since I looked at this code. But from what I can see the only places that realloc reassign the pointer and I don't believe anything points to memory inside this block, so nothing should end up dangling if the buffer moves in memory.

Have you hit a specific bug with this code?

bitshifter avatar May 19 '22 22:05 bitshifter