diff options
author | David Tolnay <dtolnay@gmail.com> | 2015-06-19 10:33:35 -0700 |
---|---|---|
committer | Nicolas Williams <nico@cryptonector.com> | 2015-06-20 16:08:56 -0500 |
commit | 4a316fbb5a1119ebb74b271129d563fd284315bc (patch) | |
tree | 51fed5c676c00384c34b4fcc49611a19149a8136 /builtin.c | |
parent | 7811ef1e1746f0963deb960af2c9623fb53c24a5 (diff) |
fix errors flagged by clang static analyzer
builtin.c: bug - free of uninitialized jv
compile.c: missing assertion
jq_test.c: buggy logic / unreachable code
jv.c: missing assertion
jv_alloc.c: false positive - intentional read of uninitialized memory
jv_file.c: dead code
Diffstat (limited to 'builtin.c')
-rw-r--r-- | builtin.c | 5 |
1 files changed, 1 insertions, 4 deletions
@@ -671,8 +671,7 @@ static jv f_match(jq_state *jq, jv input, jv regex, jv modifiers, jv testmode) { return jv_invalid_with_msg(jv_string_concat(jv_string("Regex failure: "), jv_string((char*)ebuf))); } - if (!test) - result = jv_array(); + result = test ? jv_false() : jv_array(); const char *input_string = jv_string_value(input); const UChar* start = (const UChar*)jv_string_value(input); const unsigned long length = jv_string_length_bytes(jv_copy(input)); @@ -760,8 +759,6 @@ static jv f_match(jq_state *jq, jv input, jv regex, jv modifiers, jv testmode) { start = (const UChar*)(input_string+region->end[0]); onig_region_free(region,0); } else if (onigret == ONIG_MISMATCH) { - if (test) - result = jv_false(); break; } else { /* Error */ UChar ebuf[ONIG_MAX_ERROR_MESSAGE_LEN]; |