mirror of https://github.com/xemu-project/xemu.git
migration: fix vmdesc leak on vmstate_save() error
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20190912122514.22504-2-marcandre.lureau@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
parent
240ab11fb7
commit
91490583f3
|
@ -24,4 +24,6 @@ void json_start_object(QJSON *json, const char *name);
|
||||||
const char *qjson_get_str(QJSON *json);
|
const char *qjson_get_str(QJSON *json);
|
||||||
void qjson_finish(QJSON *json);
|
void qjson_finish(QJSON *json);
|
||||||
|
|
||||||
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(QJSON, qjson_destroy)
|
||||||
|
|
||||||
#endif /* QEMU_QJSON_H */
|
#endif /* QEMU_QJSON_H */
|
||||||
|
|
|
@ -1314,7 +1314,7 @@ int qemu_savevm_state_complete_precopy_non_iterable(QEMUFile *f,
|
||||||
bool in_postcopy,
|
bool in_postcopy,
|
||||||
bool inactivate_disks)
|
bool inactivate_disks)
|
||||||
{
|
{
|
||||||
QJSON *vmdesc;
|
g_autoptr(QJSON) vmdesc = NULL;
|
||||||
int vmdesc_len;
|
int vmdesc_len;
|
||||||
SaveStateEntry *se;
|
SaveStateEntry *se;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -1375,7 +1375,6 @@ int qemu_savevm_state_complete_precopy_non_iterable(QEMUFile *f,
|
||||||
qemu_put_be32(f, vmdesc_len);
|
qemu_put_be32(f, vmdesc_len);
|
||||||
qemu_put_buffer(f, (uint8_t *)qjson_get_str(vmdesc), vmdesc_len);
|
qemu_put_buffer(f, (uint8_t *)qjson_get_str(vmdesc), vmdesc_len);
|
||||||
}
|
}
|
||||||
qjson_destroy(vmdesc);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue