diff --git a/Makefile b/Makefile index 678b3b3..fcef49f 100644 --- a/Makefile +++ b/Makefile @@ -40,6 +40,7 @@ SRCS = libunwind.c \ Lset_fpreg.c \ Lset_reg.c \ mempool.c \ - strerror.c + strerror.c \ + malloc_types.c .include diff --git a/flush_cache.c b/flush_cache.c index 966f353..c865227 100644 --- a/flush_cache.c +++ b/flush_cache.c @@ -36,8 +36,8 @@ unw_flush_cache (unw_addr_space_t as, unw_word_t lo, unw_word_t hi) for (; w; w = w->next) { if (w->index) - free (w->index); - free (w->debug_frame); + free (w->index, M_LIBUNWIND_TYPE); + free (w->debug_frame, M_LIBUNWIND_TYPE); } as->debug_frames = NULL; diff --git a/include/libunwind_i.h b/include/libunwind_i.h index 85fb05e..5ad817f 100644 --- a/include/libunwind_i.h +++ b/include/libunwind_i.h @@ -94,6 +94,7 @@ do { \ #define mutex_unlock(l) \ sx_unlock(l) +MALLOC_DECLARE(M_LIBUNWIND_TYPE); static inline int cmpxchg_ptr (void *addr, void *old, void *new) diff --git a/malloc_types.c b/malloc_types.c new file mode 100644 index 0000000..4904c25 --- /dev/null +++ b/malloc_types.c @@ -0,0 +1,4 @@ +#include + +MALLOC_DEFINE(M_LIBUNWIND_TYPE, "libunwind allocations", "Libunwind " + "Allocations"); \ No newline at end of file