summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2020-04-06 12:35:44 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-04-07 10:58:27 +0200
commita4ef152361540983152077f1e23f692b83fb5fc7 (patch)
tree5c1d2aa0a19652b7704465facaaddc13d04b96cb
parent522ff0eaefdb49e3a9ae395c97582ad4b9d716c1 (diff)
ecore_evas_cocoa: be aware of NULL data
this will now result in the promise beeing rejected. Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Differential Revision: https://phab.enlightenment.org/D11653
-rw-r--r--src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c b/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c
index 51fe657f39..7018a66691 100644
--- a/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c
+++ b/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c
@@ -514,10 +514,11 @@ _ecore_evas_cocoa_selection_request(Ecore_Evas *ee EINA_UNUSED, unsigned int sea
514 { 514 {
515 int size; 515 int size;
516 void *data; 516 void *data;
517 Eina_Content *content; 517 Eina_Content *content = NULL;
518 Eina_Rw_Slice slice; 518 Eina_Rw_Slice slice;
519 519
520 data = ecore_cocoa_clipboard_get(&size, mime_type); 520 data = ecore_cocoa_clipboard_get(&size, mime_type);
521
521 if (eina_str_has_prefix(mime_type,"text")) 522 if (eina_str_has_prefix(mime_type,"text"))
522 { 523 {
523 //ensure that we always have a \0 at the end, there is no assertion that \0 is included here. 524 //ensure that we always have a \0 at the end, there is no assertion that \0 is included here.
@@ -530,7 +531,8 @@ _ecore_evas_cocoa_selection_request(Ecore_Evas *ee EINA_UNUSED, unsigned int sea
530 slice.len = size; 531 slice.len = size;
531 slice.mem = data; 532 slice.mem = data;
532 } 533 }
533 content = eina_content_new(eina_rw_slice_slice_get(slice), mime_type); 534 if (slice.mem)
535 content = eina_content_new(eina_rw_slice_slice_get(slice), mime_type);
534 free(slice.mem); //memory got duplicated in eina_content_new 536 free(slice.mem); //memory got duplicated in eina_content_new
535 if (!content) // construction can fail because of some validation reasons 537 if (!content) // construction can fail because of some validation reasons
536 eina_promise_reject(promise, ecore_evas_no_matching_type); 538 eina_promise_reject(promise, ecore_evas_no_matching_type);