base = GC_base(p);
if (base == 0) {
+# if defined(REDIRECT_MALLOC) \
+ && ((defined(NEED_CALLINFO) && defined(GC_HAVE_BUILTIN_BACKTRACE)) \
+ || defined(GC_LINUX_THREADS) || defined(GC_SOLARIS_THREADS) \
+ || defined(MSWIN32))
+ /* In some cases, we should ignore objects that do not belong */
+ /* to the GC heap. See the comment in GC_free. */
+ if (!GC_is_heap_ptr(p)) return;
+# endif
ABORT_ARG1("Invalid pointer passed to free()", ": %p", p);
}
if ((ptr_t)p - (ptr_t)base != sizeof(oh)) {
h = HBLKPTR(p);
hhdr = HDR(h);
# if defined(REDIRECT_MALLOC) && \
- (defined(GC_SOLARIS_THREADS) || defined(GC_LINUX_THREADS) \
+ ((defined(NEED_CALLINFO) && defined(GC_HAVE_BUILTIN_BACKTRACE)) \
+ || defined(GC_SOLARIS_THREADS) || defined(GC_LINUX_THREADS) \
|| defined(MSWIN32))
+ /* This might be called indirectly by GC_print_callers to free */
+ /* the result of backtrace_symbols. */
/* For Solaris, we have to redirect malloc calls during */
/* initialization. For the others, this seems to happen */
/* implicitly. */
GC_err_printf("\t\t%s\n", name);
# if defined(GC_HAVE_BUILTIN_BACKTRACE) \
&& !defined(GC_BACKTRACE_SYMBOLS_BROKEN)
- free(sym_name); /* May call GC_free; that's OK */
+ free(sym_name); /* May call GC_[debug_]free; that's OK */
# endif
}
}