From: Stephen Dolan Date: Tue, 4 Sep 2012 19:56:44 +0000 (+0100) Subject: Make the test harness not segfault when a test fails (!) X-Git-Tag: jq-1.1~73 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=58a9b0cfe135f6a7a274c1717702c10ac0e7ee5b;p=jq Make the test harness not segfault when a test fails (!) --- diff --git a/c/main.c b/c/main.c index bad8541..b71bcad 100644 --- a/c/main.c +++ b/c/main.c @@ -52,14 +52,16 @@ void run_tests() { printf("Insufficient results\n"); pass = 0; break; - } else if (!jv_equal(expected, actual)) { + } else if (!jv_equal(jv_copy(expected), jv_copy(actual))) { printf("Expected "); - jv_dump(expected); + jv_dump(jv_copy(expected)); printf(", but got "); - jv_dump(actual); + jv_dump(jv_copy(actual)); printf("\n"); pass = 0; } + jv_free(expected); + jv_free(actual); } if (pass) { jv extra = jq_next();