Initialise jq_state->debug_cb{,_data} to NULL

To make debug/0 not call an uninitialised function pointer when using
--run-tests or when using a jq_state on which jq_set_debug_cb() has not
been called.
This commit is contained in:
Emanuele Torre authored and Nico Williams committed 2023-07-18 12:12:50 -05:00
1 parent 9e4c71558a
commit bb0f898c01
2 files changed
+8 -1

No files matched your search

+3
View File
@@ -1015,6 +1015,9 @@ jq_state *jq_init(void) {
jq->input_cb = NULL;
jq->input_cb_data = NULL;
jq->debug_cb = NULL;
jq->debug_cb_data = NULL;
jq->err_cb = default_err_cb;
jq->err_cb_data = stderr;
+5 -1
View File
@@ -1820,8 +1820,12 @@ tojson | fromjson
{"a":null}
# calling input/1 in a test doesn't crash jq
# calling input/0, or debug/0 in a test doesn't crash jq
try input catch .
null
"break"
debug
1
1