From: John Ferlan Date: Thu, 1 Aug 2013 19:54:51 +0000 (-0400) Subject: tests: Coverity found new NULL_RETURNS X-Git-Tag: CVE-2013-4239~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3b4b121423e3f85eedce64761f6cef3637c62442;p=thirdparty%2Flibvirt.git tests: Coverity found new NULL_RETURNS Coverity reported the existing missing check of the return value and subsequent use from a call to virJSONValueFromString() in testJSONAddRemove(). --- diff --git a/tests/jsontest.c b/tests/jsontest.c index a37a980238..1d385d44b5 100644 --- a/tests/jsontest.c +++ b/tests/jsontest.c @@ -60,11 +60,17 @@ testJSONAddRemove(const void *data) { const struct testInfo *info = data; virJSONValuePtr json; - virJSONValuePtr name; + virJSONValuePtr name = NULL; char *result = NULL; int ret = -1; json = virJSONValueFromString(info->doc); + if (!json) { + if (virTestGetVerbose()) + fprintf(stderr, "Fail to parse %s\n", info->doc); + ret = -1; + goto cleanup; + } switch (virJSONValueObjectRemoveKey(json, "name", &name)) { case 1: