]> git.mdlowis.com Git - archive/afm.git/commitdiff
wip: diagnosing memleaks
authora bellenir <a@bellenir.com>
Sat, 26 Jul 2014 01:50:20 +0000 (01:50 +0000)
committera bellenir <a@bellenir.com>
Sat, 26 Jul 2014 01:50:20 +0000 (01:50 +0000)
source/screen.c
source/workdir.c

index 93aa93ea7b87e81f5b7ee44a3c9634ed5a85e607..2402c44b1c3af845c71a8f8bec13a000134b566f 100644 (file)
@@ -33,6 +33,7 @@ void screen_init(void) {
 }
 
 void screen_deinit(void) {
+       fprintf(stderr, "deinitializing screen\n");
     mem_release(Screen_List);
 }
 
@@ -123,6 +124,7 @@ static frame_t* screen_frame_new(void) {
 }
 
 static void screen_frame_free(void* p_frame_ptr) {
+       fprintf(stderr, "freeing frame\n");
     frame_t* p_frame = (frame_t*)p_frame_ptr;
     wclear(p_frame->p_win);
     wborder(p_frame->p_win, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
index 6e161492e62fcf8490f51dacba028ca23e6f81cd..da8989c4de1564f7ddf576c4bb8b77137fe661bd 100644 (file)
@@ -1,3 +1,4 @@
+/* external libraries */
 #include <ncurses.h>
 #include <string.h>
 #include <stdlib.h>
@@ -5,8 +6,11 @@
 #include <unistd.h>
 #include <stdio.h>
 
+/* internal libraries */
 #include "vec.h"
 #include "mem.h"
+
+/* internal headers */
 #include "state.h"
 #include "workdir.h"
 #include "screen.h"
@@ -33,6 +37,7 @@ WorkDir_T* workdir_new(char* path){
 
 void workdir_free(void* p_wd){
     WorkDir_T* wd = (WorkDir_T*)p_wd;
+    fprintf(stderr, "freeing workdir\n");
     mem_release(wd->vfiles);
     mem_release(wd->path);
 }
@@ -128,6 +133,7 @@ void workdir_ls(WorkDir_T* wd){
         free(filename);
         filename = 0;
     }
+    pclose(ls);
     //mem_release(dotdot); #dont free, because there's a bug(?) in vectors and reference counting
     //reference counter is not incremented for added items, so releasinghere will free the memory
     mem_release(cmd);