g_variant_get(parameters, "(&s&si)", &pkgname, &tag, ¶m_uid);
ret = _validate_and_set_param_uid_with_uid(uid, ¶m_uid);
if (ret != NOTIFICATION_ERROR_NONE)
- return ret;
+ goto out;
DbgPrint("_load_noti_by_tag pkgname : %s, tag : %s ", pkgname, tag);
ret = notification_noti_get_by_tag(noti, pkgname, tag, param_uid);
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ ErrPrint("There is no notification that is matched tag [%s]", tag);
+ goto out;
+ }
- DbgPrint("notification_noti_get_by_tag ret : %d", ret);
print_noti(noti);
-
*reply_body = notification_ipc_make_gvariant_from_noti(noti, true);
- notification_free(noti);
-
if (*reply_body == NULL) {
ErrPrint("cannot make reply_body");
- return NOTIFICATION_ERROR_OUT_OF_MEMORY;
+ ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
}
} else {
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
}
+
+out:
+ if (noti)
+ notification_free(noti);
+
DbgPrint("_load_noti_by_tag done !!");
return ret;
}
g_variant_get(parameters, "(&sii)", &pkgname, &priv_id, ¶m_uid);
ret = _validate_and_set_param_uid_with_uid(uid, ¶m_uid);
if (ret != NOTIFICATION_ERROR_NONE)
- return ret;
+ goto out;
DbgPrint("load_noti_by_priv_id pkgname : %s, priv_id : %d ", pkgname, priv_id);
ret = notification_noti_get_by_priv_id(noti, pkgname, priv_id, param_uid);
-
- DbgPrint("notification_noti_get_by_priv_id ret : %d", ret);
- print_noti(noti);
+ if (ret != NOTIFICATION_ERROR_NONE)
+ goto out;
*reply_body = notification_ipc_make_gvariant_from_noti(noti, true);
- notification_free(noti);
-
if (*reply_body == NULL) {
ErrPrint("cannot make reply_body");
- return NOTIFICATION_ERROR_OUT_OF_MEMORY;
+ ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
}
} else {
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
}
- DbgPrint("_load_noti_by_priv_id done !!");
+out:
+ if (noti)
+ notification_free(noti);
+
+ DbgPrint("notification_load_noti_by_priv_id done [%d]", ret);
return ret;
}
g_variant_unref(body);
if (ret != NOTIFICATION_ERROR_NONE) {
ErrPrint("failed to make a notification:%d\n", ret);
- return ret;
+ goto out;
}
ret = notification_noti_check_count_for_template(noti, &count);
- if (count >= NOTI_TEMPLATE_LIMIT)
- return NOTIFICATION_ERROR_MAX_EXCEEDED;
+ if (count >= NOTI_TEMPLATE_LIMIT) {
+ ErrPrint("Exceed limit value that is saved tamplate :%d\n", ret);
+ ret = NOTIFICATION_ERROR_MAX_EXCEEDED;
+ goto out;
+ }
ret = notification_noti_add_template(noti, template_name);
- if (ret != NOTIFICATION_ERROR_NONE) {
+ if (ret != NOTIFICATION_ERROR_NONE)
ErrPrint("failed to add a notification:%d\n", ret);
- return ret;
- }
} else {
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
}
+out:
+ if (noti)
+ notification_free(noti);
+
+ DbgPrint("notification_add_noti_template is done [%d]", ret);
return ret;
}
ret = aul_app_get_appid_bypid_for_uid(pid, appid, sizeof(appid), uid);
if (ret != AUL_R_OK) {
ErrPrint("failed to get appid:%d", ret);
- return ret;
+ ret = NOTIFICATION_ERROR_INVALID_PARAMETER;
+ goto out;
}
ret = notification_noti_get_package_template(noti, appid, template_name);
if (ret != NOTIFICATION_ERROR_NONE) {
DbgPrint("failed to get template:%d", ret);
- return ret;
+ goto out;
}
*reply_body = notification_ipc_make_gvariant_from_noti(noti, false);
- notification_free(noti);
-
if (*reply_body == NULL) {
ErrPrint("cannot make reply_body");
- return NOTIFICATION_ERROR_OUT_OF_MEMORY;
+ ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
}
} else {
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
}
- DbgPrint("_get_noti_template done !!");
+out:
+ if (noti)
+ notification_free(noti);
+
+ DbgPrint("notification_get_noti_template is done [%d]", ret);
return ret;
}
ret = notification_noti_get_package_template(noti, pkgname, template_name);
if (ret != NOTIFICATION_ERROR_NONE) {
- DbgPrint("failed to get template:%d", ret);
- return ret;
+ ErrPrint("failed to get template:%d", ret);
+ goto out;
}
*reply_body = notification_ipc_make_gvariant_from_noti(noti, false);
- notification_free(noti);
-
if (*reply_body == NULL) {
ErrPrint("cannot make reply_body");
- return NOTIFICATION_ERROR_OUT_OF_MEMORY;
+ ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
}
} else {
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
}
- DbgPrint("_get_noti_package_template done !!");
+out:
+ if (noti)
+ notification_free(noti);
+ DbgPrint("notification_get_noti_package_template is done [%d]", ret);
return ret;
}
notification_h noti;
noti = notification_create(NOTIFICATION_TYPE_NOTI);
-
if (noti != NULL) {
g_variant_get(parameters, "(vi)", &coupled_body, &event_type);
g_variant_get(coupled_body, "(v)", &body);
ret = notification_ipc_make_noti_from_gvariant(noti, body);
+ g_variant_unref(coupled_body);
+ g_variant_unref(body);
+
if (ret != NOTIFICATION_ERROR_NONE) {
ErrPrint("failed to make a notification from gvariant");
- return ret;
+ goto out;
}
- g_variant_unref(coupled_body);
- g_variant_unref(body);
-
ret = notification_get_id(noti, NULL, &priv_id);
if (ret != NOTIFICATION_ERROR_NONE)
- return ret;
+ goto out;
info = __find_sender_info_by_priv_id(priv_id);
- if (info == NULL || info->busname == NULL)
- return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ if (info == NULL || info->busname == NULL) {
+ ret = NOTIFICATION_ERROR_INVALID_PARAMETER;
+ goto out;
+ }
if (!info->watcher_id) {
if (!is_existed_busname(info->busname)) {
__event_list = g_list_remove(g_list_first(__event_list), info);
__free_event_info(info);
- return NOTIFICATION_ERROR_IO_ERROR;
+ ret = NOTIFICATION_ERROR_IO_ERROR;
+ goto out;
} else {
info->watcher_id = __insert_sender_watcher_id(info);
}
}
ret = send_event_notify_by_busname(parameters, "send_event", info->busname, PROVIDER_NOTI_EVENT_INTERFACE_NAME);
- notification_free(noti);
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ ErrPrint("failed to send event");
+ goto out;
+ }
+ *reply_body = g_variant_new("()");
+ if (*reply_body == NULL) {
+ ErrPrint("cannot make reply body");
+ ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
+ }
} else {
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
}
- *reply_body = g_variant_new("()");
- if (*reply_body == NULL) {
- ErrPrint("cannot make reply body");
- return NOTIFICATION_ERROR_OUT_OF_MEMORY;
- }
-
- DbgPrint("notification_send_noti_event done !! %d", ret);
+out:
+ if (noti)
+ notification_free(noti);
+ DbgPrint("notification_send_noti_event is done [%d]", ret);
return ret;
}
ret = notification_noti_delete_all(NOTIFICATION_TYPE_NONE, appid, &num_deleted, &list_deleted, uid);
if (ret != NOTIFICATION_ERROR_NONE) {
ErrPrint("failed to delete notifications:%d\n", ret);
- if (list_deleted != NULL)
- free(list_deleted);
- return ret;
+ goto out;
}
if (num_deleted > 0) {
g_variant_unref(deleted_noti_list);
if (ret != NOTIFICATION_ERROR_NONE) {
ErrPrint("failed to send notify:%d\n", ret);
- return ret;
+ goto out;
}
for (i = 0; i < num_deleted; i++) {
ret = __delete_sender_info(*(list_deleted + i));
if (ret != NOTIFICATION_ERROR_NONE)
- return ret;
+ goto out;
}
-
- free(list_deleted);
}
-
+out:
+ if (list_deleted != NULL)
+ free(list_deleted);
return ret;
}