Add notification_h null check 22/74622/3 accepted/tizen/common/20160616.151524 accepted/tizen/ivi/20160616.002901 accepted/tizen/mobile/20160616.002830 accepted/tizen/tv/20160616.002813 accepted/tizen/wearable/20160616.002722 submit/tizen/20160615.073423
authorseungha.son <seungha.son@samsung.com>
Wed, 15 Jun 2016 02:37:25 +0000 (11:37 +0900)
committerseungha.son <seungha.son@samsung.com>
Wed, 15 Jun 2016 06:55:57 +0000 (15:55 +0900)
Signed-off-by: seungha.son <seungha.son@samsung.com>
Change-Id: I61fe7a688411332c8bb146aca70db3f103835ee2

src/notification_ipc.c

index 115c4d2..7565628 100755 (executable)
@@ -985,6 +985,12 @@ int notification_ipc_request_load_noti_grouping_list(notification_type_e type, i
 
                while (g_variant_iter_loop(iter, "(v)", &iter_body)) {
                        noti = notification_create(NOTIFICATION_TYPE_NOTI);
+                       if (!noti) {
+                               result = NOTIFICATION_ERROR_OUT_OF_MEMORY;
+                               NOTIFICATION_ERR("failed to create a notification");
+                               notification_free_list(*list);
+                               break;
+                       }
                        g_variant_get(iter_body, "(v)", &noti_body);
                        notification_ipc_make_noti_from_gvariant(noti, noti_body);
                        *list = notification_list_append(*list, noti);
@@ -1030,6 +1036,12 @@ int notification_ipc_request_load_noti_detail_list(const char *pkgname,
 
                while (g_variant_iter_loop(iter, "(v)", &iter_body)) {
                        noti = notification_create(NOTIFICATION_TYPE_NOTI);
+                       if (!noti) {
+                               result = NOTIFICATION_ERROR_OUT_OF_MEMORY;
+                               NOTIFICATION_ERR("failed to create a notification");
+                               notification_free_list(*list);
+                               break;
+                       }
                        g_variant_get(iter_body, "(v)", &noti_body);
                        notification_ipc_make_noti_from_gvariant(noti, noti_body);
                        *list = notification_list_append(*list, noti);