devilhorns pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=be87c4a0c22a88014d2061e255a7a1b65706efa1

commit be87c4a0c22a88014d2061e255a7a1b65706efa1
Author: Christopher Michael <[email protected]>
Date:   Tue Mar 10 10:28:01 2020 -0400

    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
---
 src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c 
b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
index b2bf7c75ec..0c80b501cb 100644
--- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
+++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
@@ -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;
 }
 

-- 


Reply via email to