ecore-evas-wayland: Fix resource leak

If we are going to be exiting this function without setting up the
ecore_main_fd_handler (and thus passing forign_slice), then we should
free forign_slice as it was previously calloc'd above.

Fixes CID1420322
This commit is contained in:
Christopher Michael 2020-03-10 10:28:01 -04:00
parent e34837f28d
commit be87c4a0c2
1 changed files with 5 additions and 1 deletions

View File

@ -2645,7 +2645,7 @@ _wl_interaction_send(void *data, int type EINA_UNUSED, void *event)
if (buffer == ECORE_EVAS_SELECTION_BUFFER_LAST)
{
//silent return, this send request was *not* for this window
return ECORE_CALLBACK_PASS_ON;
goto end;
}
selection = &wdata->selection_data[buffer];
@ -2653,7 +2653,11 @@ _wl_interaction_send(void *data, int type EINA_UNUSED, void *event)
EINA_SAFETY_ON_NULL_GOTO(selection->callbacks.delivery, end);
EINA_SAFETY_ON_FALSE_GOTO(selection->callbacks.delivery(ee, ev->seat, buffer, ev->type, &forign_slice->slice), end);
ecore_main_fd_handler_add(ev->fd, ECORE_FD_WRITE, _write_to_fd, forign_slice, NULL, NULL);
return ECORE_CALLBACK_PASS_ON;
end:
free(forign_slice);
return ECORE_CALLBACK_PASS_ON;
}