summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2016-09-13 18:06:02 +0100
committerRobin Watts <robin.watts@artifex.com>2016-09-13 18:09:04 +0100
commita1a5fc2d220c66f316e4c527de4ae6719c6fba35 (patch)
tree56a8949ae36f5726188ef3c15bd4c606322b336d /source
parent725a38a601e17d493f8d48140f6a31badfa38f3e (diff)
downloadmupdf-a1a5fc2d220c66f316e4c527de4ae6719c6fba35.tar.xz
Fix Memento Android backtrace code.
Thanks to Sebastian for pointing out that the demangling code wants a malloced block, cos it might realloc it. Drop back to the dumber version.
Diffstat (limited to 'source')
-rw-r--r--source/fitz/memento.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/source/fitz/memento.c b/source/fitz/memento.c
index 20195213..15fb2b1d 100644
--- a/source/fitz/memento.c
+++ b/source/fitz/memento.c
@@ -718,14 +718,14 @@ static void Memento_showStacktrace(void **stack, int numberOfFrames)
for (i = 0; i < numberOfFrames; i++)
{
Dl_info info;
- int status = 0;
if (dladdr(stack[i], &info))
{
+ int status = 0;
const char *sym = info.dli_sname ? info.dli_sname : "<unknown>";
- const debuf[256];
- char *demangled = __cxa_demangle(sym, debuf, sizeof(debuf), &status);
+ char *demangled = __cxa_demangle(sym, NULL, 0, &status);
int offset = stack[i] - info.dli_saddr;
fprintf(stderr, " [%p]%s(+0x%x)\n", stack[i], demangled && status == 0 ? demangled : sym, offset);
+ free(demangled);
}
else
{