summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYonit Halperin <yhalperi@redhat.com>2012-11-13 13:14:16 -0500
committerYonit Halperin <yhalperi@redhat.com>2012-11-26 11:08:10 -0500
commit7785a005d43b5ad6e8fe1c9409a8d9d767e3eb00 (patch)
tree295c4207fc35f732679f911cdf165b4b4272d6ea
parentd8bad0f999da6ccb4aebcc0763a46b2c0624a5a5 (diff)
downloadspice-7785a005d43b5ad6e8fe1c9409a8d9d767e3eb00.tar.gz
spice-7785a005d43b5ad6e8fe1c9409a8d9d767e3eb00.tar.xz
spice-7785a005d43b5ad6e8fe1c9409a8d9d767e3eb00.zip
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.
-rw-r--r--server/smartcard.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/server/smartcard.c b/server/smartcard.c
index a7e81d53..f1e62440 100644
--- a/server/smartcard.c
+++ b/server/smartcard.c
@@ -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);
}
}