diff options
author | Kichan Kwon <k_c.kwon@samsung.com> | 2016-11-08 19:48:19 +0900 |
---|---|---|
committer | Kunhoon Baik <knhoon.baik@samsung.com> | 2016-11-14 22:04:50 +0900 |
commit | 958484629334d98d4cc2faac79c5cf5f5b28d5b6 (patch) | |
tree | 9f64cbdb43d2f120ceacec0404bf2d12ac99141d | |
parent | 376d694f10303b6cf511f8c8bd65afad803bdb75 (diff) | |
download | resourced-958484629334d98d4cc2faac79c5cf5f5b28d5b6.tar.gz resourced-958484629334d98d4cc2faac79c5cf5f5b28d5b6.tar.bz2 resourced-958484629334d98d4cc2faac79c5cf5f5b28d5b6.zip |
Fix memory issues
Change-Id: If6b6aec2f11454c796b2f54615d99921926ff4f0
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
-rw-r--r-- | src/proc-stat/proc-main.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/proc-stat/proc-main.c b/src/proc-stat/proc-main.c index c7d037ca..e29a840f 100644 --- a/src/proc-stat/proc-main.c +++ b/src/proc-stat/proc-main.c @@ -146,7 +146,7 @@ static char *proc_get_runtime_app_info_path(const struct proc_app_info *pai) assert(data); \ \ snprintf(app_info_node, PATH_MAX, "%s/"#node"", path); \ - \ + *data = (char*)malloc(PATH_MAX); \ return fread_str(app_info_node, data); \ } @@ -763,6 +763,7 @@ int proc_remove_app_list(const pid_t pid) } } proc_app_list = g_slist_remove(proc_app_list, pai); + app_list.list = proc_app_list; free(pai); break; } else if (pai->childs) { @@ -799,8 +800,7 @@ struct proc_app_info *proc_create_app_list(const char *appid, const char *pkgid) pai->proc_exclude = resourced_proc_excluded(appid); proc_app_list = proc_app_list_open(); - proc_app_list = g_slist_prepend(proc_app_list, pai); - app_list.list = proc_app_list; + app_list.list = g_slist_prepend(proc_app_list, pai); return pai; } @@ -821,7 +821,7 @@ int proc_delete_all_lists(void) else if (pai->type == PROC_TYPE_SERVICE) ppi->svc_list = g_slist_remove(ppi->svc_list, pai); } - proc_app_list = g_slist_remove(proc_app_list, pai); + app_list.list = g_slist_remove(proc_app_list, pai); resourced_appinfo_put(pai->ai); free(pai); } @@ -1121,7 +1121,7 @@ static int proc_restore_runtime_app_info(const char *path) if (ret < 0) { _I("pid %d is already terminated. remove it", pai->main_pid); proc_app_list = proc_app_list_open(); - proc_app_list = g_slist_remove(proc_app_list, pai); + app_list.list = g_slist_remove(proc_app_list, pai); resourced_appinfo_put(pai->ai); free(pai); return ret; @@ -1302,7 +1302,7 @@ void proc_set_group(pid_t ownerpid, pid_t childpid, char *pkgname) if (pai->runtime_exclude) owner->runtime_exclude += pai->runtime_exclude; proc_app_list = proc_app_list_open(); - proc_app_list = g_slist_remove(proc_app_list, pai); + app_list.list = g_slist_remove(proc_app_list, pai); free(pai); } else { _D("main pid(%d) was different from childpid(%d)", |