From 6007a51f17420194b7179db4fd55c9086ece06e5 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Thu, 31 Mar 2016 13:08:38 -0500 Subject: [PATCH] wayland: Don't leak a clipboard source if adding fd handler fails Reviewed-by: Mike Blumenkrantz --- src/bin/e_comp_wl_data.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/bin/e_comp_wl_data.c b/src/bin/e_comp_wl_data.c index d71d3aa20..8183a9632 100644 --- a/src/bin/e_comp_wl_data.c +++ b/src/bin/e_comp_wl_data.c @@ -940,7 +940,12 @@ e_comp_wl_clipboard_source_create(const char *mime_type, uint32_t serial, int fd ecore_main_fd_handler_add(fd, ECORE_FD_READ, _e_comp_wl_clipboard_source_save, e_comp->wl_comp_data, NULL, NULL); - if (!source->fd_handler) return NULL; + if (!source->fd_handler) + { + _mime_types_free(&source->data_source); + free(source); + return NULL; + } } source->fd = fd;