summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeung-Woo Kim <sw0312.kim@samsung.com>2022-09-22 16:57:11 +0900
committerSeung-Woo Kim <sw0312.kim@samsung.com>2022-09-22 19:20:56 +0900
commit0c9b0923b34047adcd9b7571dbe16fada1550d48 (patch)
treea1ca1d3301719141c3330da1897e552f696347aa
parentc4b135508be3f3e115cd2d4aab9db84d2cfb0eac (diff)
downloadmemps-tizen_7.0_hotfix.tar.gz
memps-tizen_7.0_hotfix.tar.bz2
memps-tizen_7.0_hotfix.zip
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.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/memps.c b/memps.c
index 12f4017..b56ff3a 100644
--- a/memps.c
+++ b/memps.c
@@ -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);