diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2013-08-06 10:24:04 -0700 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2013-08-06 10:24:04 -0700 |
commit | 3c30f0f950a616df4c899c57839ef34946ead8b1 (patch) | |
tree | cf6712c60b418f446244686ffca3453bb6cdcf27 /src/data-device.c | |
parent | 09252d4b5eecf6068ce45039299dd904d0e6389e (diff) | |
download | weston-3c30f0f950a616df4c899c57839ef34946ead8b1.tar.gz |
data-device.c: Handle OOM in weston_data_source_send_offer()
If we fail to allocate the resource, clean up and return NULL.
Diffstat (limited to 'src/data-device.c')
-rw-r--r-- | src/data-device.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/data-device.c b/src/data-device.c index 2000f90e..4e3f4fc0 100644 --- a/src/data-device.c +++ b/src/data-device.c @@ -120,6 +120,11 @@ weston_data_source_send_offer(struct weston_data_source *source, offer->resource = wl_resource_create(wl_resource_get_client(target), &wl_data_offer_interface, 1, 0); + if (offer->resource == NULL) { + free(offer); + return NULL; + } + wl_resource_set_implementation(offer->resource, &data_offer_interface, offer, destroy_data_offer); |