From bba8c350a589af3c38d09d7253c02a7ce040f6c6 Mon Sep 17 00:00:00 2001 From: Peter Meerwald-Stadler Date: Wed, 6 Sep 2017 09:53:06 +0200 Subject: [PATCH] json-test: Fix Coverity warning Cosmetic resource leak in test code Coverity ID: #1454314 Signed-off-by: Peter Meerwald-Stadler --- src/tests/json-test.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/tests/json-test.c b/src/tests/json-test.c index 3e956dbad..0894a3064 100644 --- a/src/tests/json-test.c +++ b/src/tests/json-test.c @@ -248,7 +248,11 @@ START_TEST(bad_test) { }; for (i = 0; i < PA_ELEMENTSOF(bad_parse); i++) { - fail_unless(pa_json_parse(bad_parse[i]) == NULL); + pa_json_object *obj; + + fail_unless((obj = pa_json_parse(bad_parse[i])) == NULL); + if (obj) + pa_json_object_free(obj); } } END_TEST