[Spice-commits] server/red-parse-qxl.c server/red-stream-device.c
Christophe Fergau
teuf at kemper.freedesktop.org
Tue Apr 10 12:35:35 UTC 2018
server/red-parse-qxl.c | 3 +--
server/red-stream-device.c | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
New commits:
commit 216bf191b8a542aab8ab4a376b61bfb9d4546ae3
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Thu Apr 5 10:30:00 2018 +0200
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 at redhat.com>
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;
}
More information about the Spice-commits
mailing list