diff options
author | Seung-Woo Kim <sw0312.kim@samsung.com> | 2022-09-22 16:57:11 +0900 |
---|---|---|
committer | Seung-Woo Kim <sw0312.kim@samsung.com> | 2022-09-22 19:20:56 +0900 |
commit | 0c9b0923b34047adcd9b7571dbe16fada1550d48 (patch) | |
tree | a1ca1d3301719141c3330da1897e552f696347aa | |
parent | c4b135508be3f3e115cd2d4aab9db84d2cfb0eac (diff) | |
download | memps-tizen_7.0.tar.gz memps-tizen_7.0.tar.bz2 memps-tizen_7.0.zip |
Adjust scope of map info list variabletizen_7.0_m2_releaseaccepted/tizen/unified/20220923.125202accepted/tizen/7.0/unified/hotfix/20221116.105745accepted/tizen/7.0/unified/20221110.061330tizen_7.0_hotfixtizen_7.0accepted/tizen_7.0_unified_hotfixaccepted/tizen_7.0_unified
The milist, map info list is allocated for each process and freed
by get_trib_mapinfo(), but the pointer life cycle is not well
shown. Adjust variable scope for each process, and add comment
about its free in get_trib_mapinfo().
Change-Id: I79ed7aadedbac919ce7f3cb9109e485120368835
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
-rw-r--r-- | memps.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1117,7 +1117,6 @@ static int show_map_all_new(int output_type, char *output_path) DIR *pDir = NULL; struct dirent *curdir; unsigned int pid; - mapinfo *milist; geminfo *glist; geminfo *gpu_glist; unsigned total_pss = 0; @@ -1184,6 +1183,8 @@ static int show_map_all_new(int output_type, char *output_path) errno = 0; while ((curdir = readdir(pDir)) != NULL && !errno) { + mapinfo *milist; + pid = atoi(curdir->d_name); if (pid < 1 || pid > pid_max || pid == getpid()) continue; @@ -1195,7 +1196,7 @@ static int show_map_all_new(int output_type, char *output_path) if (milist == 0) continue; - /* get classified map info */ + /* get classified map info, milist will be freed */ get_trib_mapinfo(pid, milist, glist, gpu_glist, &tmi); oom_score_adj = get_oomscoreadj(pid, oom_path); |