diff --git a/src/util/virjson.c b/src/util/virjson.c index be472d49e442e9e5bb54fd5775325d6d87ea2507..dc662bf8e90b43a0d1c68c11adff21bb6abb0ba3 100644 --- a/src/util/virjson.c +++ b/src/util/virjson.c @@ -1838,7 +1838,7 @@ virJSONValueFromString(const char *jsonstring) if (!hand) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Unable to create JSON parser")); - goto cleanup; + return NULL; } /* Yajl 2 is nice enough to default to rejecting trailing garbage. */ diff --git a/tools/nss/libvirt_nss_leases.c b/tools/nss/libvirt_nss_leases.c index 7c431e4d53c48b2d0ed4febd8335ebae4e646577..015bbc4ab64458153a362b600367d01591f7b1c7 100644 --- a/tools/nss/libvirt_nss_leases.c +++ b/tools/nss/libvirt_nss_leases.c @@ -426,7 +426,8 @@ findLeases(const char *file, *addrs = NULL; *naddrs = 0; } - yajl_free(parser); + if (parser) + yajl_free(parser); free(parserState.entry.ipaddr); free(parserState.entry.macaddr); free(parserState.entry.hostname); diff --git a/tools/nss/libvirt_nss_macs.c b/tools/nss/libvirt_nss_macs.c index 05d096a348057ef8c51671e379dbbd3e3d9d0860..d4b165eef61ae680b940b219611f87cdf8e6c8d0 100644 --- a/tools/nss/libvirt_nss_macs.c +++ b/tools/nss/libvirt_nss_macs.c @@ -278,7 +278,8 @@ findMACs(const char *file, *macs = NULL; *nmacs = 0; } - yajl_free(parser); + if (parser) + yajl_free(parser); for (i = 0; i < parserState.entry.nmacs; i++) free(parserState.entry.macs[i]); free(parserState.entry.macs);