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>
DIR *pDir = NULL;
struct dirent *curdir;
unsigned int pid;
- mapinfo *milist;
geminfo *glist;
geminfo *gpu_glist;
unsigned total_pss = 0;
errno = 0;
while ((curdir = readdir(pDir)) != NULL && !errno) {
+ mapinfo *milist;
+
pid = atoi(curdir->d_name);
if (pid < 1 || pid > pid_max || pid == getpid())
continue;
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);