Fix timeout issue when noti add, update 61/117561/1 accepted/tizen/3.0/common/20170307.113253 accepted/tizen/3.0/ivi/20170306.221124 accepted/tizen/3.0/mobile/20170306.220940 accepted/tizen/3.0/tv/20170306.220955 accepted/tizen/3.0/wearable/20170306.221046 submit/tizen_3.0/20170306.124113
authorMyungki Lee <mk5004.lee@samsung.com>
Mon, 6 Mar 2017 11:22:17 +0000 (20:22 +0900)
committerMyungki Lee <mk5004.lee@samsung.com>
Mon, 6 Mar 2017 11:22:17 +0000 (20:22 +0900)
- did not check error

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

index 66cc2dd..8b64146 100755 (executable)
@@ -598,7 +598,7 @@ int notification_add_noti(GVariant *parameters, GVariant **reply_body, const cha
 
                ret = _validate_and_set_noti_with_uid(uid, noti, &noti_uid);
                if (ret != NOTIFICATION_ERROR_NONE)
-                       return ret;
+                       goto out;
 
                ret = notification_noti_check_tag(noti);
                if (ret == NOTIFICATION_ERROR_NOT_EXIST_ID)
@@ -606,22 +606,27 @@ int notification_add_noti(GVariant *parameters, GVariant **reply_body, const cha
                else if (ret == NOTIFICATION_ERROR_ALREADY_EXIST_ID)
                        ret = _update_noti(reply_body, noti, noti_uid);
 
+               if (ret != NOTIFICATION_ERROR_NONE)
+                       goto out;
+
                ret = notification_get_event_flag(noti, &event_flag);
                if (ret != NOTIFICATION_ERROR_NONE)
-                       return ret;
+                       goto out;
 
                if (event_flag == true) {
                        ret = notification_get_id(noti, NULL, &priv_id);
                        if (ret != NOTIFICATION_ERROR_NONE)
-                               return ret;
+                               goto out;
 
                        __add_sender_info(priv_id, sender);
                }
-               notification_free(noti);
        } else {
                ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
        }
 
+out:
+       notification_free(noti);
+
        DbgPrint("notification_add_noti ret : %d", ret);
        return ret;
 }
@@ -679,15 +684,16 @@ int notification_update_noti(GVariant *parameters, GVariant **reply_body, uid_t
 
                ret = _validate_and_set_noti_with_uid(uid, noti, &noti_uid);
                if (ret != NOTIFICATION_ERROR_NONE)
-                       return ret;
+                       goto out;
 
-               if (ret == NOTIFICATION_ERROR_NONE)
-                       ret = _update_noti(reply_body, noti, noti_uid);
+               ret = _update_noti(reply_body, noti, noti_uid);
 
-               notification_free(noti);
        } else {
                ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
        }
+
+out:
+       notification_free(noti);
        return ret;
 }