Merge pull request #231 from DRMacIver/fix_mem_leak_in_compile
args to jq_compile_args were not getting freed when there were errors in the compile
This commit is contained in:
commit
4ba0c8baef
2 files changed
+8
-1
No files matched your search
@@ -770,12 +770,12 @@ int jq_compile_args(jq_state *jq, const char* str, jv args) {
|
|||||||
program = gen_var_binding(gen_const(value), jv_string_value(name), program);
|
program = gen_var_binding(gen_const(value), jv_string_value(name), program);
|
||||||
jv_free(name);
|
jv_free(name);
|
||||||
}
|
}
|
||||||
jv_free(args);
|
|
||||||
nerrors = builtins_bind(jq, &program);
|
nerrors = builtins_bind(jq, &program);
|
||||||
if (nerrors == 0) {
|
if (nerrors == 0) {
|
||||||
nerrors = block_compile(program, &locations, &jq->bc);
|
nerrors = block_compile(program, &locations, &jq->bc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
jv_free(args);
|
||||||
if (nerrors) {
|
if (nerrors) {
|
||||||
jv s = jv_string_fmt("%d compile %s", nerrors,
|
jv s = jv_string_fmt("%d compile %s", nerrors,
|
||||||
nerrors > 1 ? "errors" : "error");
|
nerrors > 1 ? "errors" : "error");
|
||||||
|
|||||||
Reference in new issue
Block a user