Fixed calloc crash points 76/92776/2
authorOleksander Kostenko <o.kostenko@samsung.com>
Tue, 18 Oct 2016 12:33:55 +0000 (15:33 +0300)
committerOleksander Kostenko <o.kostenko@samsung.com>
Wed, 19 Oct 2016 07:49:36 +0000 (10:49 +0300)
Change-Id: I42dae9ef9308961c1ef02420716bcd107c6b016a
Signed-off-by: Oleksander Kostenko <o.kostenko@samsung.com>
src/main.c
src/notification-setting-info.c
src/set-schedule-info.c

index 00ad612..47394fc 100755 (executable)
@@ -19,6 +19,7 @@
 #include <libintl.h>
 #include <package_manager.h>
 #include <system_settings.h>
+#include <assert.h>
 #include "do-not-disturb-efl.h"
 #include "pkgmgr-setting-info.h"
 #include "excepted-apps-efl.h"
@@ -342,6 +343,12 @@ int main(int argc, char *argv[])
        NOTISET_TRACE_BEGIN;
 
        ug_data *ug_main = calloc(1, sizeof(ug_data));
+    if(!ug_main)
+    {
+        NOTISET_ERR("CALLOC ERROR");
+        ug_main = NULL;
+        assert(false);
+    }
 
        set_app_ui_data(ug_main);
 
index 6190005..e74f972 100755 (executable)
@@ -45,6 +45,7 @@ void create_app_notification_list()
     remove_apps_noti_allowed_list();
     remove_apps_noti_blocked_list();
     setting_info = calloc(1, sizeof(setting_info_s));
+    ret_if(!setting_info);
 
     notification_setting_get_setting_array(&setting_array, &count);
     ret_if(!setting_array);
@@ -117,6 +118,7 @@ void create_do_not_disturb_application_list()
     remove_excepted_apps_list();
 
     setting_info = calloc(1, sizeof(setting_info_s));
+    ret_if(!setting_info);
 
     notification_setting_get_setting_array(&setting_array, &count);
     ret_if(!setting_array);
@@ -247,17 +249,21 @@ void create_notification_on_ls_list()
     remove_lower_noti_list();
 
     setting_info = calloc(1, sizeof(setting_info_s));
+    ret_if(!setting_info);
     item_info_s *item_info = NULL;
 
     item_info = calloc(1, sizeof(item_info_s));
+    ret_if(!item_info);
     item_info->name = strdup(APP_STRING("IDS_QP_OPT_SHOW_ALL_CONTENT_ABB"));
     setting_info->lower_noti_list = eina_list_append(setting_info->lower_noti_list, item_info);
 
     item_info = calloc(1, sizeof(item_info_s));
+    ret_if(!item_info);
     item_info->name = strdup(APP_STRING("IDS_QP_OPT_HIDE_SENSITIVE_CONTENT_ABB"));
     setting_info->lower_noti_list = eina_list_append(setting_info->lower_noti_list, item_info);
 
     item_info = calloc(1, sizeof(item_info_s));
+    ret_if(!item_info);
     item_info->name = strdup(APP_STRING("IDS_QP_OPT_DONT_SHOW_NOTIFICATIONS_ABB"));
     setting_info->lower_noti_list = eina_list_append(setting_info->lower_noti_list, item_info);
     NOTISET_TRACE_BEGIN;
index d076fab..0e6a275 100755 (executable)
@@ -338,6 +338,9 @@ static Evas_Object *create_week_button(Evas_Object *parent, const char *text, dn
     evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
 
     changecolor_s *cc = calloc(1, sizeof(changecolor_s));
+    if(!cc)
+        return NULL;
+
     cc->week = week;
     cc->label = label;
     cc->text = text;