From: a bellenir Date: Sat, 26 Jul 2014 03:25:12 +0000 (+0000) Subject: plug leak X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=c2978efe96029d8e1927d4183fddc74ef7f43828;p=archive%2Fafm.git plug leak --- diff --git a/source/workdir.c b/source/workdir.c index 57e3391..db748f1 100644 --- a/source/workdir.c +++ b/source/workdir.c @@ -104,6 +104,8 @@ void workdir_cd(WorkDir_T* wd) { wd->path = newpath; wd->idx = 0; wd->top_index = 0; + }else{ + mem_release(newpath); } workdir_ls(wd); state_set_screen_dirty(true); @@ -125,10 +127,10 @@ void workdir_ls(WorkDir_T* wd){ strcpy(dotdot, ".."); //initialize new file vector wd->vfiles = vec_new(0); - if (strcmp(wd->path, "/") != 0) - vec_push_back(wd->vfiles, dotdot); - else - mem_release(dotdot); + if (strcmp(wd->path, "/") != 0) + vec_push_back(wd->vfiles, dotdot); + else + mem_release(dotdot); while ((read = getline(&filename, &len, ls)) != -1){ char* lol = mem_allocate(read*sizeof(char), NULL); filename[read-1]=0; //remove ending newline