mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Don't pass NULL to yajl_free()
Unfortunately, yajl_free() is not NOP on NULL. It really does expect a valid pointer. Therefore, check whether the pointer we want to pass to it is NULL or not. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
@@ -1838,7 +1838,7 @@ virJSONValueFromString(const char *jsonstring)
|
|||||||
if (!hand) {
|
if (!hand) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Unable to create JSON parser"));
|
_("Unable to create JSON parser"));
|
||||||
goto cleanup;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Yajl 2 is nice enough to default to rejecting trailing garbage. */
|
/* Yajl 2 is nice enough to default to rejecting trailing garbage. */
|
||||||
|
|||||||
@@ -426,6 +426,7 @@ findLeases(const char *file,
|
|||||||
*addrs = NULL;
|
*addrs = NULL;
|
||||||
*naddrs = 0;
|
*naddrs = 0;
|
||||||
}
|
}
|
||||||
|
if (parser)
|
||||||
yajl_free(parser);
|
yajl_free(parser);
|
||||||
free(parserState.entry.ipaddr);
|
free(parserState.entry.ipaddr);
|
||||||
free(parserState.entry.macaddr);
|
free(parserState.entry.macaddr);
|
||||||
|
|||||||
@@ -278,6 +278,7 @@ findMACs(const char *file,
|
|||||||
*macs = NULL;
|
*macs = NULL;
|
||||||
*nmacs = 0;
|
*nmacs = 0;
|
||||||
}
|
}
|
||||||
|
if (parser)
|
||||||
yajl_free(parser);
|
yajl_free(parser);
|
||||||
for (i = 0; i < parserState.entry.nmacs; i++)
|
for (i = 0; i < parserState.entry.nmacs; i++)
|
||||||
free(parserState.entry.macs[i]);
|
free(parserState.entry.macs[i]);
|
||||||
|
|||||||
Reference in New Issue
Block a user