Skip to content

fix(tlsf): forward realloc to tlsf#124

Open
Conaclos wants to merge 1 commit intorust-embedded:masterfrom
Conaclos:conaclos/tlsf-forward-realloc
Open

fix(tlsf): forward realloc to tlsf#124
Conaclos wants to merge 1 commit intorust-embedded:masterfrom
Conaclos:conaclos/tlsf-forward-realloc

Conversation

@Conaclos
Copy link

Hi!

I am working in an embedded context that shipped some shims for C realloc. The shim simply delegates the allocation/reallocation to the global Rust allocator.
It passed a dummy layout to alloc::realloc and alloc::dealloc, assuming that the global allocator ignore them and retrieve the original layout on its own.
I am currently using the tlsf allocator ad global allocator.
So I discovered a bug where the current embedded-alloc implementation doesn't ignore the dummy layout in the case of reallocations because it used the default implementation of the Rust library.
This is a bug: realloc should be forwarded to the underlying rlsf crate.
This PR fixes this bug.

@Conaclos Conaclos requested a review from a team as a code owner February 25, 2026 09:39
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

Successfully merging this pull request may close these issues.

1 participant