[Spice-devel] [PATCH] char_device.c: fix call to spice_marshaller_add_ref with memory on stack

Hans de Goede hdegoede at redhat.com
Thu Nov 22 02:12:46 PST 2012


Hi,

Looks good, ACK.

Regards,

Hans


On 11/21/2012 08:53 PM, Yonit Halperin wrote:
> rhbz#862352
> ---
>   server/char_device.c | 14 ++++++++------
>   1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/server/char_device.c b/server/char_device.c
> index ac2632d..141ec88 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,
>


More information about the Spice-devel mailing list