Hi! I'm trying to understand how the backtrace_vector_* APIs are meant to work and used, but at least for alloc.c don't see how it can work properly:
Both backtrace_vector_grow and backtrace_vector_release use base = realloc (vec->base, alc); or vec->base = realloc (vec->base, vec->size); (note, in the latter case it is even a memory leak if realloc fails), but that assumes that that vec->base has been returned by malloc/realloc etc. But, void backtrace_vector_finish (struct backtrace_state *state ATTRIBUTE_UNUSED, struct backtrace_vector *vec) { vec->base = (char *) vec->base + vec->size; vec->size = 0; } will change vec->base so that it no longer is an address returned by malloc/realloc, so next time you call backtrace_vector_grow, if it will actually need to reallocate anything, it will crash in realloc or silently misbehave. If this works properly in mmap.c implementation, perhaps backtrace_vector_finish in alloc.c should just backtrace_vector_release and memset (*vec, 0, sizeof (*vec)); ? Jakub