billiob pushed a commit to branch master.

http://git.enlightenment.org/apps/terminology.git/commit/?id=c2cd0035e46f3fe9cfb89b06e0321835cb72f6f2

commit c2cd0035e46f3fe9cfb89b06e0321835cb72f6f2
Author: Boris Faure <[email protected]>
Date:   Wed Nov 11 23:08:22 2020 +0100

    test malloc/calloc's return. Fix CID1436182
---
 src/bin/keyin.c              | 9 ++++++---
 src/bin/options_background.c | 9 +++++++--
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/bin/keyin.c b/src/bin/keyin.c
index 5691c01..0b6c0cb 100644
--- a/src/bin/keyin.c
+++ b/src/bin/keyin.c
@@ -401,9 +401,12 @@ cb_term_new(Evas_Object *termio_obj)
 
         length = (strlen(path) + strlen(cwd) + strlen(template) - 3);
         cmd = malloc(sizeof(char) * length);
-        snprintf(cmd, length, template, path, cwd);
-        ecore_exe_run(cmd, NULL);
-        free(cmd);
+        if (cmd)
+          {
+             snprintf(cmd, length, template, path, cwd);
+             ecore_exe_run(cmd, NULL);
+             free(cmd);
+          }
      }
    else
      {
diff --git a/src/bin/options_background.c b/src/bin/options_background.c
index b0dfae2..9deaa81 100644
--- a/src/bin/options_background.c
+++ b/src/bin/options_background.c
@@ -303,10 +303,10 @@ _rec_read_directorys(Background_Ctx *ctx, Eina_List *list,
                             item = calloc(1, sizeof(Background_Item));
                             if (item)
                               {
-                                 notify = calloc(1,
-                                          sizeof(Insert_Gen_Grid_Item_Notify));
                                  item->path = eina_stringshare_add(path);
                                  list = eina_list_append(list, item);
+                                 notify = calloc(1,
+                                          sizeof(Insert_Gen_Grid_Item_Notify));
                                  if (notify)
                                    {
                                       //insert item to gengrid
@@ -350,6 +350,11 @@ _refresh_directory(Background_Ctx *ctx, const char* data)
    item_class->func.content_get = _grid_content_get;
 
    item = calloc(1, sizeof(Background_Item));
+   if (!item)
+     {
+        elm_gengrid_item_class_free(item_class);
+        return;
+     }
    ctx->background_list = eina_list_append(ctx->background_list, item);
 
    //Insert None Item

-- 


Reply via email to