[client] wayland: fix use after free bugs

This commit is contained in:
Geoffrey McRae 2023-11-11 11:33:51 +11:00
parent f6befb4567
commit 3c1405719c
2 changed files with 8 additions and 0 deletions

View File

@ -475,6 +475,7 @@ void waylandCBRequest(LG_ClipboardData type)
close(data->fd); close(data->fd);
free(data->buf); free(data->buf);
free(data); free(data);
return;
} }
wlCb.currentRead = data; wlCb.currentRead = data;

View File

@ -109,10 +109,17 @@ void waylandPresentationFrame(void)
return; return;
struct FrameData * data = malloc(sizeof(*data)); struct FrameData * data = malloc(sizeof(*data));
if (!data)
{
DEBUG_ERROR("out of memory");
return;
}
if (clock_gettime(wlWm.clkId, &data->sent)) if (clock_gettime(wlWm.clkId, &data->sent))
{ {
DEBUG_ERROR("clock_gettime failed: %s\n", strerror(errno)); DEBUG_ERROR("clock_gettime failed: %s\n", strerror(errno));
free(data); free(data);
return;
} }
struct wp_presentation_feedback * feedback = wp_presentation_feedback(wlWm.presentation, wlWm.surface); struct wp_presentation_feedback * feedback = wp_presentation_feedback(wlWm.presentation, wlWm.surface);