Skip to content

Commit

Permalink
Check nomem_handler->handler before calling it
Browse files Browse the repository at this point in the history
  • Loading branch information
nicowilliams committed Aug 25, 2023
1 parent 70807e2 commit 3dd0f86
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/jv_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 3dd0f86

Please sign in to comment.