]> granicus.if.org Git - jq/commitdiff
args to jq_compile_args were not getting freed when there were errors in the compile
authorDavid R. MacIver <david@drmaciver.com>
Sun, 8 Dec 2013 15:28:29 +0000 (15:28 +0000)
committerDavid R. MacIver <david@drmaciver.com>
Sun, 8 Dec 2013 15:28:29 +0000 (15:28 +0000)
execute.c

index ef727dc33780b5aa8050f5eff3c4969822fdd081..387bf3897cec7eb502c7759919126fad7a9e2266 100644 (file)
--- a/execute.c
+++ b/execute.c
@@ -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);
       jv_free(name);
     }
-    jv_free(args);
     nerrors = builtins_bind(jq, &program);
     if (nerrors == 0) {
       nerrors = block_compile(program, &locations, &jq->bc);
     }
   }
+  jv_free(args);
   if (nerrors) {
     jv s = jv_string_fmt("%d compile %s", nerrors,
                          nerrors > 1 ? "errors" : "error");