Fix g_list_remove and g_slist_remove bug 04/231404/3
authorINSUN PYO <insun.pyo@samsung.com>
Wed, 22 Apr 2020 00:39:41 +0000 (09:39 +0900)
committerINSUN PYO <insun.pyo@samsung.com>
Wed, 22 Apr 2020 01:57:12 +0000 (10:57 +0900)
Change-Id: I6c460647b69e35f44b7e30a51de14e1c93c9f919

src/common/dbus-handler.c
src/common/notifier.c

index 372746f..9331fb3 100644 (file)
@@ -406,8 +406,8 @@ void d_bus_exit(void)
        for (iter = dbus_signal_list; iter; iter = g_list_next(iter)) {
                signal = (struct d_bus_signal *)iter->data;
                g_dbus_connection_signal_unsubscribe(conn, signal->subscription_id);
+               dbus_signal_list = g_list_remove(dbus_signal_list, signal);
                free(signal);
-               dbus_signal_list = g_list_remove(dbus_signal_list, iter);
        }
 
        /* Remove D-Bus method list */
@@ -415,8 +415,8 @@ void d_bus_exit(void)
                method_handle = (struct d_bus_method_handle *)iter->data;
                g_dbus_connection_unregister_object(conn, method_handle->subscription_id);
                g_dbus_node_info_unref(method_handle->node_info);
+               dbus_method_handle_list = g_list_remove(dbus_method_handle_list, method_handle);
                free(method_handle);
-               dbus_method_handle_list = g_list_remove(dbus_method_handle_list, iter);
        }
 
        g_object_unref(conn);
index c96ece0..61b85ee 100644 (file)
@@ -112,7 +112,7 @@ static int notifier_exit(void *data)
 
        gslist_for_each_item(iter, reverse_list) {
                notifier = (struct resourced_notifier *)iter->data;
-               resourced_notifier_list = g_slist_remove(resourced_notifier_list, iter);
+               resourced_notifier_list = g_slist_remove(resourced_notifier_list, notifier);
                free(notifier);
        }
        return RESOURCED_ERROR_NONE;