mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-03-07 04:34:31 -05:00
xwayland: fix memory leak on pipe() failure
When pipe() fails in xwm_selection_send_data(), the function returns without cleaning up the allocated transfer structure and initialized wl_array. This causes a memory leak. Add wl_array_release() and free() to clean up resources when pipe() fails. Signed-off-by: Wang Yu <wangyu@uniontech.com>
This commit is contained in:
parent
6d9aa17572
commit
a55b85e2e1
1 changed files with 2 additions and 0 deletions
|
|
@ -283,6 +283,8 @@ static bool xwm_selection_send_data(struct wlr_xwm_selection *selection,
|
|||
int p[2];
|
||||
if (pipe(p) == -1) {
|
||||
wlr_log_errno(WLR_ERROR, "pipe() failed");
|
||||
wl_array_release(&transfer->source_data);
|
||||
free(transfer);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue