Check nomem_handler->handler before calling it

This commit is contained in:
Nicolas Williams authored and Nico Williams committed 2023-08-25 10:13:46 -05:00
1 parent 70807e2b1b
commit 2c3561810d
1 file changed
+1 -1
+1 -1
View File
@@ -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");