Currently, red-parse-qxl.c open codes g_memdup() when it needs to duplicate the cursor data, while red-stream-device.c does this using 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@xxxxxxxxxx> --- server/red-parse-qxl.c | 3 +-- 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 69748698a..d0e7eb718 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 7f01236ba..0dcc4d609 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; } -- 2.14.3 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel