mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2025-12-28 08:01:26 +00:00
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>
This commit is contained in:
parent
8e302a7596
commit
216bf191b8
@ -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;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user