summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Williams <nico@cryptonector.com>2023-08-24 19:25:07 -0500
committerNico Williams <nico@cryptonector.com>2023-08-25 10:13:46 -0500
commit2c3561810d846efbf55de3b2444c78a8c125fc47 (patch)
tree5134c4c71be2062476fd805a74d5183110bc684f
parent70807e2b1b3643019f3283b94d61998b9b35ee0e (diff)
Check nomem_handler->handler before calling it
-rw-r--r--src/jv_alloc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/jv_alloc.c b/src/jv_alloc.c
index 678335c7..40c244c5 100644
--- a/src/jv_alloc.c
+++ b/src/jv_alloc.c
@@ -111,7 +111,7 @@ static void memory_exhausted() {
tsd_init_nomem_handler();
nomem_handler = pthread_getspecific(nomem_handler_key);
- if (nomem_handler)
+ if (nomem_handler && nomem_handler->handler)
nomem_handler->handler(nomem_handler->data); // Maybe handler() will longjmp() to safety
// Or not
fprintf(stderr, "jq: error: cannot allocate memory\n");