char *qemuMonitorGuestPanicEventInfoFormatMsg(qemuMonitorEventPanicInfo *info);
void qemuMonitorEventPanicInfoFree(qemuMonitorEventPanicInfo *info);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(qemuMonitorEventPanicInfo, qemuMonitorEventPanicInfoFree);
void qemuMonitorEventRdmaGidStatusFree(qemuMonitorRdmaGidStatus *info);
void qemuMonitorMemoryDeviceSizeChangeFree(qemuMonitorMemoryDeviceSizeChange *info);
static qemuMonitorEventPanicInfo *
qemuMonitorJSONGuestPanicExtractInfoHyperv(virJSONValue *data)
{
- qemuMonitorEventPanicInfo *ret;
-
- ret = g_new0(qemuMonitorEventPanicInfo, 1);
+ g_autoptr(qemuMonitorEventPanicInfo) ret = g_new0(qemuMonitorEventPanicInfo, 1);
ret->type = QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_HYPERV;
virJSONValueObjectGetNumberUlong(data, "arg5", &ret->data.hyperv.arg5) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("malformed hyperv panic data"));
- goto error;
+ return NULL;
}
- return ret;
-
- error:
- qemuMonitorEventPanicInfoFree(ret);
- return NULL;
+ return g_steal_pointer(&ret);
}
static qemuMonitorEventPanicInfo *
qemuMonitorJSONGuestPanicExtractInfoS390(virJSONValue *data)
{
- qemuMonitorEventPanicInfo *ret;
+ g_autoptr(qemuMonitorEventPanicInfo) ret = NULL;
int core;
unsigned long long psw_mask, psw_addr;
const char *reason = NULL;
virJSONValueObjectGetNumberUlong(data, "psw-addr", &psw_addr) < 0 ||
!(reason = virJSONValueObjectGetString(data, "reason"))) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("malformed s390 panic data"));
- goto error;
+ return NULL;
}
ret->data.s390.core = core;
ret->data.s390.reason = g_strdup(reason);
- return ret;
-
- error:
- qemuMonitorEventPanicInfoFree(ret);
- return NULL;
+ return g_steal_pointer(&ret);
}
static qemuMonitorEventPanicInfo *