Skip to content
Myr

Free expected value on invalid actual for test

Before adoption: this commit came in with the history the project adopted, so no landing records it.

valgrind (3.19.0) locally on macOS docker container seems to detect this leak but not CI. $ cat modulemeta.test modulemeta | .deps |= length "c" {"whatever":null,"deps":6} $ valgrind --error-exitcode=1 --leak-check=full -q ./jq --run-tests < modulemeta.test Test #1: 'modulemeta | .deps |= length' at line number 1 *** Insufficient results for test at line number 3: modulemeta | .deps |= length 0 of 1 tests passed (0 malformed, 0 skipped) ==14129== 482 (392 direct, 90 indirect) bytes in 1 blocks are definitely lost in loss record 7 of 8 ==14129== at 0x48407B4: malloc (vg_replace_malloc.c:381) ==14129== by 0x13BC78: jv_mem_alloc (jv_alloc.c:122) ==14129== by 0x1371C6: jvp_object_new (jv.c:1521) ==14129== by 0x145840: parse_token (jv_parse.c:167) ==14129== by 0x145840: scan (jv_parse.c:684) ==14129== by 0x145840: jv_parser_next (jv_parse.c:793) ==14129== by 0x1463CB: jv_parse_sized (jv_parse.c:865) ==14129== by 0x136BD9: run_jq_tests (jq_test.c:183) ==14129== by 0x1370FA: jq_testsuite (jq_test.c:34) ==14129== by 0x13135C: main (main.c:582) ==14129==

authored by Mattias Wadman · committed by Nico Williams · parent 16ae275 · Browse files · 1 file+1 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+1 added−0 removed

  • other:+1 added−0 removed

1 file+1 added−0 removed

modified:src/jq_test.c+1 added
186 unmodified lines
187 continue;188 }189 jv actual = jq_next(jq);190 if (!jv_is_valid(actual)) {191 jv_free(expected);192 jv_free(actual);193 printf("*** Insufficient results for test at line number %u: %s\n", lineno, prog);194 pass = 0;195 break;
209 unmodified lines