diff options
author | Ian Lance Taylor <iant@google.com> | 2015-09-08 16:46:16 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2015-09-08 16:46:16 +0000 |
commit | c478516be7517e20e150150fea4399d60434bfc3 (patch) | |
tree | eae6d20512a5643294e17bfb41e704ab2559be16 /libbacktrace/mmap.c | |
parent | 2eab96661b6c08679ffd4a084f59f3935cfcddb9 (diff) |
re PR other/67457 (segfault in libbacktrace)
PR other/67457
* backtrace.c: #include "internal.h".
(struct backtrace_data): Add can_alloc field.
(unwind): If can_alloc is false, don't try to get file/line
information.
(backtrace_full): Set can_alloc field in bdata.
* alloc.c (backtrace_alloc): Don't call error_callback if it is
NULL.
* mmap.c (backtrace_alloc): Likewise.
* internal.h: Update comments for backtrace_alloc and
backtrace_free.
From-SVN: r227533
Diffstat (limited to 'libbacktrace/mmap.c')
-rw-r--r-- | libbacktrace/mmap.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libbacktrace/mmap.c b/libbacktrace/mmap.c index 47c564f13f8..1910cb1f9eb 100644 --- a/libbacktrace/mmap.c +++ b/libbacktrace/mmap.c @@ -77,7 +77,8 @@ backtrace_free_locked (struct backtrace_state *state, void *addr, size_t size) } } -/* Allocate memory like malloc. */ +/* Allocate memory like malloc. If ERROR_CALLBACK is NULL, don't + report an error. */ void * backtrace_alloc (struct backtrace_state *state, @@ -140,7 +141,10 @@ backtrace_alloc (struct backtrace_state *state, page = mmap (NULL, asksize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (page == MAP_FAILED) - error_callback (data, "mmap", errno); + { + if (error_callback) + error_callback (data, "mmap", errno); + } else { size = (size + 7) & ~ (size_t) 7; |