smartcard.c: avoid marshalling migration data with reference to a memory that might be released before send has completed

The current solution just copy the buffer. Currently data that is read
from the guest is always copied before sending it to the client. When we
will have ref count for these buffers, we can also use it for marshalling
the migration data.
This commit is contained in:
Yonit Halperin 2012-11-13 13:14:16 -05:00
parent d8bad0f999
commit 7785a005d4

View File

@ -508,7 +508,7 @@ static void smartcard_channel_send_migrate_data(RedChannelClient *rcc,
spice_marshaller_add_uint8(m, state->reader_added);
spice_marshaller_add_uint32(m, state->buf_used);
m2 = spice_marshaller_get_ptr_submarshaller(m, 0);
spice_marshaller_add_ref(m2, state->buf, state->buf_used);
spice_marshaller_add(m2, state->buf, state->buf_used);
spice_debug("reader added %d partial read size %u", state->reader_added, state->buf_used);
}
}