Skip to content
Browse files

CUSTOM_MEMALIGN - match internal free call to alloc

During a call to CUSTOM_MEMALIGN(), if the first allocation try fails to
"happen to be" properly allocated, then it is freed and explicitely
This free() call did not match the xxmalloc() one: CUSTOM_FREE() instead
of xxfree()

This causes a crash when calling gdb for example:
  LD_PRELOAD=~/Hoard/src/ gdb --args ls
  • Loading branch information...
GabrielGanne committed Feb 15, 2019
1 parent e52d3e0 commit 8abfda161ec551cdae6a8b19b4cbb4aefdcf5948
Showing with 1 addition and 1 deletion.
  1. +1 −1 wrappers/wrapper.cpp
@@ -213,7 +213,7 @@ extern "C" void * MYCDECL CUSTOM_MEMALIGN (size_t alignment, size_t size)
return ptr;
// It was not aligned as requested: free the object and allocate a big one.
ptr = xxmalloc (size + 2 * alignment);
void * alignedPtr = (void *) (((size_t) ptr + alignment - 1) & ~(alignment - 1));
return alignedPtr;

0 comments on commit 8abfda1

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.