summaryrefslogtreecommitdiffstats
path: root/server/char_device.c
diff options
context:
space:
mode:
authorYonit Halperin <yhalperi@redhat.com>2012-11-13 10:38:34 -0500
committerYonit Halperin <yonit@dhcp-191-132.bos.redhat.com>2012-11-21 09:19:46 -0500
commit4cd4e7cf19d7fc074510685a95255a3ed785b577 (patch)
treee2d22daf3b3a4c85bfffa87fa08f2ed2eb9b3e8e /server/char_device.c
parent45a09e4113d0ce2a74a9b791c4bb2271f3423b07 (diff)
downloadspice-4cd4e7cf19d7fc074510685a95255a3ed785b577.tar.gz
spice-4cd4e7cf19d7fc074510685a95255a3ed785b577.tar.xz
spice-4cd4e7cf19d7fc074510685a95255a3ed785b577.zip
char_device.c: fix call to spice_marshaller_add_ref with memory on stack
rhbz#862352
Diffstat (limited to 'server/char_device.c')
-rw-r--r--server/char_device.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/server/char_device.c b/server/char_device.c
index ac2632d6..141ec884 100644
--- a/server/char_device.c
+++ b/server/char_device.c
@@ -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;
-
- 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));
+ SpiceMigrateDataCharDevice *mig_data;
+
+ 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,