diff options
author | Christophe Fergeau <cfergeau@redhat.com> | 2018-04-05 10:30:00 +0200 |
---|---|---|
committer | Christophe Fergeau <cfergeau@redhat.com> | 2018-04-10 14:34:44 +0200 |
commit | 216bf191b8a542aab8ab4a376b61bfb9d4546ae3 (patch) | |
tree | 574388e105977e01e5c48587c5ea97157b8b5071 | |
parent | 8e302a759648c1a950f49b0a73b79e6663cf2a37 (diff) |
cursor: Consistently use g_memdup() for cursor data
Currently, red-parse-qxl.c uses g_malloc+memcpy to duplicate the cursor
data when it could use g_memdup() instead. red-stream-device.c does the
same thing but uses spice_memdup(). This commit makes use of g_memdup()
in both cases so that this memory is consistently allocated through
glib.
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
-rw-r--r-- | server/red-parse-qxl.c | 3 | ||||
-rw-r--r-- | server/red-stream-device.c | 2 |
2 files changed, 2 insertions, 3 deletions
diff --git a/server/red-parse-qxl.c b/server/red-parse-qxl.c index 69748698..d0e7eb71 100644 --- a/server/red-parse-qxl.c +++ b/server/red-parse-qxl.c @@ -1450,8 +1450,7 @@ static bool red_get_cursor(RedMemSlotInfo *slots, int group_id, if (free_data) { red->data = data; } else { - red->data = g_malloc(size); - memcpy(red->data, data, size); + red->data = g_memdup(data, size); } return true; } diff --git a/server/red-stream-device.c b/server/red-stream-device.c index e91df88d..d81c3b26 100644 --- a/server/red-stream-device.c +++ b/server/red-stream-device.c @@ -344,7 +344,7 @@ stream_msg_cursor_set_to_cursor_cmd(const StreamMsgCursorSet *msg, size_t msg_si return NULL; } cursor->data_size = size_required; - cursor->data = spice_memdup(msg->data, size_required); + cursor->data = g_memdup(msg->data, size_required); return cmd; } |