char_device.c: fix call to spice_marshaller_add_ref with memory on stack

rhbz#862352
This commit is contained in:
Yonit Halperin 2012-11-13 10:38:34 -05:00 committed by Yonit Halperin
parent 45a09e4113
commit 4cd4e7cf19

View File

@ -816,12 +816,14 @@ void spice_char_device_wakeup(SpiceCharDeviceState *dev)
void spice_char_device_state_migrate_data_marshall_empty(SpiceMarshaller *m)
{
SpiceMigrateDataCharDevice mig_data;
SpiceMigrateDataCharDevice *mig_data;
memset(&mig_data, 0, sizeof(mig_data));
mig_data.version = SPICE_MIGRATE_DATA_CHAR_DEVICE_VERSION;
mig_data.connected = FALSE;
spice_marshaller_add_ref(m, (uint8_t *)&mig_data, sizeof(SpiceMigrateDataCharDevice));
spice_debug(NULL);
mig_data = (SpiceMigrateDataCharDevice *)spice_marshaller_reserve_space(m,
sizeof(*mig_data));
memset(mig_data, 0, sizeof(*mig_data));
mig_data->version = SPICE_MIGRATE_DATA_CHAR_DEVICE_VERSION;
mig_data->connected = FALSE;
}
void spice_char_device_state_migrate_data_marshall(SpiceCharDeviceState *dev,