Skip to content

Commit 2c35618

Browse files
committed
Check nomem_handler->handler before calling it
1 parent 70807e2 commit 2c35618

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/jv_alloc.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ static void memory_exhausted() {
111111
tsd_init_nomem_handler();
112112

113113
nomem_handler = pthread_getspecific(nomem_handler_key);
114-
if (nomem_handler)
114+
if (nomem_handler && nomem_handler->handler)
115115
nomem_handler->handler(nomem_handler->data); // Maybe handler() will longjmp() to safety
116116
// Or not
117117
fprintf(stderr, "jq: error: cannot allocate memory\n");

0 commit comments

Comments
 (0)