Fix memory leak when remove item from g_list 65/264865/1
authorSuyeon Hwang <stom.hwang@samsung.com>
Fri, 1 Oct 2021 08:52:47 +0000 (17:52 +0900)
committerSuyeon Hwang <stom.hwang@samsung.com>
Fri, 1 Oct 2021 08:52:47 +0000 (17:52 +0900)
Change-Id: I18f0f9aac40afb49b220477fd0e8072c54ed7608
Signed-off-by: Suyeon Hwang <stom.hwang@samsung.com>
client/stt_client.c
server/sttd_server.c

index a9eef07..ea475dc 100644 (file)
@@ -146,6 +146,8 @@ int stt_client_destroy(stt_h stt)
                                data = NULL;
                                stt = NULL;
 
+                               g_list_free(iter);
+
                                return 0;
                        }
 
index e70ac44..859616d 100644 (file)
@@ -521,7 +521,7 @@ int sttd_finalize()
        if (0 < g_list_length(g_proc_list)) {
                iter = g_list_first(g_proc_list);
                while (NULL != iter) {
-                       g_proc_list = g_list_remove_link(g_proc_list, iter);
+                       g_proc_list = g_list_delete_link(g_proc_list, iter);
                        iter = g_list_first(g_proc_list);
                }
        }
@@ -554,7 +554,7 @@ static void __read_proc()
        if (0 < g_list_length(g_proc_list)) {
                iter = g_list_first(g_proc_list);
                while (NULL != iter) {
-                       g_proc_list = g_list_remove_link(g_proc_list, iter);
+                       g_proc_list = g_list_delete_link(g_proc_list, iter);
                        iter = g_list_first(g_proc_list);
                }
        }