Use VIR_AUTOPTR and get rid of the cleanup label.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
virHashTablePtr hash,
bool backingChain)
{
- int ret = -1;
int nstats = 0;
int rc;
size_t i;
- virJSONValuePtr devices;
+ VIR_AUTOPTR(virJSONValue) devices = NULL;
if (!(devices = qemuMonitorJSONQueryBlockstats(mon)))
return -1;
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("blockstats device entry was not "
"in expected format"));
- goto cleanup;
+ return -1;
}
if (!(dev_name = virJSONValueObjectGetString(dev, "device"))) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("blockstats device entry was not "
"in expected format"));
- goto cleanup;
+ return -1;
}
if (*dev_name == '\0')
backingChain);
if (rc < 0)
- goto cleanup;
+ return -1;
if (rc > nstats)
nstats = rc;
}
- ret = nstats;
-
- cleanup:
- virJSONValueFree(devices);
- return ret;
+ return nstats;
}