summaryrefslogtreecommitdiff
path: root/libbacktrace/alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbacktrace/alloc.c')
-rw-r--r--libbacktrace/alloc.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libbacktrace/alloc.c b/libbacktrace/alloc.c
index 143ef68ca51..772d3bfb8ad 100644
--- a/libbacktrace/alloc.c
+++ b/libbacktrace/alloc.c
@@ -44,7 +44,8 @@ POSSIBILITY OF SUCH DAMAGE. */
backtrace functions may not be safely invoked from a signal
handler. */
-/* 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 ATTRIBUTE_UNUSED,
@@ -55,7 +56,10 @@ backtrace_alloc (struct backtrace_state *state ATTRIBUTE_UNUSED,
ret = malloc (size);
if (ret == NULL)
- error_callback (data, "malloc", errno);
+ {
+ if (error_callback)
+ error_callback (data, "malloc", errno);
+ }
return ret;
}