Use VIR_AUTOFREE and get rid of the cleanup section.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
const char *cmdstr)
{
struct qemuMonitorTestHandlerData *data = item->opaque;
- char *reformatted = NULL;
- char *errmsg = NULL;
+ VIR_AUTOFREE(char *) reformatted = NULL;
+ VIR_AUTOFREE(char *) errmsg = NULL;
int ret = -1;
/* JSON strings will be reformatted to simplify checking */
} else {
if (data->cmderr) {
if (virAsprintf(&errmsg, "%s: %s", data->cmderr, cmdstr) < 0)
- goto cleanup;
+ return -1;
ret = qemuMonitorTestAddErrorResponse(test, errmsg);
} else {
}
}
- cleanup:
- VIR_FREE(errmsg);
- VIR_FREE(reformatted);
return ret;
}