#define LOG_TAG "CAPI_APPFW_APP_MANAGER"
-static int __remove_app_manager_event_info(app_manager_event_info *head, int req_id)
+static int __remove_app_manager_event_info(app_manager_event_info **head, int req_id)
{
app_manager_event_info *prev;
app_manager_event_info *current;
- current = prev = head;
+ current = prev = *head;
if (current == NULL)
return APP_MANAGER_ERROR_INVALID_PARAMETER;
while (current) {
if (current->req_id == req_id) {
+ if (prev == current)
+ *head = current->next;
prev->next = current->next;
free(current);
- current = NULL;
return APP_MANAGER_ERROR_NONE;
}
prev = current;
app_evt->event_cb(pkg_type, appid, event_type,
APP_MANAGER_EVENT_STATE_FAILED, app_evt, app_evt->user_data);
- ret = __remove_app_manager_event_info(app_evt->head, req_id);
+ ret = __remove_app_manager_event_info(&(app_evt->head), req_id);
if (ret != APP_MANAGER_ERROR_NONE) {
LOGE("failed to remove app event info");
return APP_MANAGER_ERROR_REQUEST_FAILED;