woohyun pushed a commit to branch master.

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

commit 3897603796a74f438167cacc3bba43b76b41d3dd
Author: WooHyun Jung <[email protected]>
Date:   Tue Apr 14 08:49:42 2020 +0900

    evas_main: add null check for safety
---
 src/lib/evas/canvas/evas_main.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/lib/evas/canvas/evas_main.c b/src/lib/evas/canvas/evas_main.c
index 757f3e47cd..fc53f64dc8 100644
--- a/src/lib/evas/canvas/evas_main.c
+++ b/src/lib/evas/canvas/evas_main.c
@@ -123,20 +123,28 @@ _efl_gfx_image_load_error_to_evas_load_error(Eina_Error 
err)
 static Eina_Content*
 _markup_to_utf8(Eina_Content *from, const char *to_type)
 {
+   Eina_Content *ret = NULL;
    Eina_Slice slice = eina_content_data_get(from);
    char *utf8 = evas_textblock_text_markup_to_utf8(NULL, slice.mem);
-   Eina_Content *ret = eina_content_new((Eina_Slice)EINA_SLICE_STR_FULL(utf8), 
to_type);
-   free(utf8);
+   if (utf8)
+     {
+        ret = eina_content_new((Eina_Slice)EINA_SLICE_STR_FULL(utf8), to_type);
+        free(utf8);
+     }
    return ret;
 }
 
 static Eina_Content*
 _utf8_to_markup(Eina_Content *from, const char *to_type)
 {
+   Eina_Content *ret = NULL;
    Eina_Slice slice = eina_content_data_get(from);
    char *markup = evas_textblock_text_utf8_to_markup(NULL, slice.mem);
-   Eina_Content *ret = 
eina_content_new((Eina_Slice)EINA_SLICE_STR_FULL(markup), to_type);
-   free(markup);
+   if (markup)
+     {
+        ret = eina_content_new((Eina_Slice)EINA_SLICE_STR_FULL(markup), 
to_type);
+        free(markup);
+     }
    return ret;
 }
 

-- 


Reply via email to