Add exception handling code 08/167008/2
authormk5004.lee <mk5004.lee@samsung.com>
Mon, 15 Jan 2018 04:03:52 +0000 (13:03 +0900)
committermk5004.lee <mk5004.lee@samsung.com>
Mon, 15 Jan 2018 05:49:50 +0000 (14:49 +0900)
- notification_ipc_make_gvariant_from_setting fail case
  unnecessary reply_body unref

Change-Id: I9303d0bbb77f72a8d58540b93abef8fdc513b62a
Signed-off-by: mk5004.lee <mk5004.lee@samsung.com>
src/notification_service.c

index 7afea59..d5a3365 100755 (executable)
@@ -920,6 +920,11 @@ static int __send_list_to_socket(int fd, notification_list_h get_list, uid_t uid
                noti = notification_list_get_data(list_iter);
                notification_set_private_sharing(noti, uid);
                body = notification_ipc_make_gvariant_from_noti(noti, true);
+               if (body == NULL) {
+                       ERR("Failed to make gvariant to noti");
+                       ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
+                       break;
+               }
                ret = notification_ipc_socket_write_string(fd,
                                (char *)g_variant_get_data(body),
                                g_variant_get_size(body));
@@ -989,8 +994,6 @@ err:
                close(fd);
        if (get_list)
                notification_free_list(get_list);
-       if (reply_body)
-               g_variant_unref(reply_body);
 
        ERR("notification service fail, method name[load_noti_grouping_list] [%d]", ret);
        g_dbus_method_invocation_return_error(invocation, NOTIFICATION_ERROR,