diff options
author | emersion <contact@emersion.fr> | 2017-12-16 17:46:07 +0100 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2017-12-16 17:46:07 +0100 |
commit | 50d91bd260efb767a35697ce016dbb415893c1a3 (patch) | |
tree | f0de1f05d0afff6cd2a2baebd36b4771bf280aab | |
parent | 9e345f0f98804646f080acde3f576e314f2a73bb (diff) | |
download | wlroots-50d91bd260efb767a35697ce016dbb415893c1a3.tar.xz |
Fix potential memory leak
-rw-r--r-- | types/wlr_data_device.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/types/wlr_data_device.c b/types/wlr_data_device.c index 7cd9c6ba..b8177137 100644 --- a/types/wlr_data_device.c +++ b/types/wlr_data_device.c @@ -232,8 +232,12 @@ static void handle_offer_source_destroyed(struct wl_listener *listener, static struct wlr_data_offer *wlr_data_source_send_offer( struct wlr_data_source *source, struct wlr_seat_client *target) { + if (wl_list_empty(&target->data_devices)) { + return NULL; + } + struct wlr_data_offer *offer = calloc(1, sizeof(struct wlr_data_offer)); - if (offer == NULL || wl_list_empty(&target->data_devices)) { + if (offer == NULL) { return NULL; } |