Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the realloc may change pointer #3

Open
wiltchamberian opened this issue May 12, 2022 · 1 comment
Open

the realloc may change pointer #3

wiltchamberian opened this issue May 12, 2022 · 1 comment

Comments

@wiltchamberian
Copy link

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.

@bitshifter
Copy link
Owner

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants