]> git.mdlowis.com Git - projs/tide.git/commitdiff
fixed some memory leaks
authorMichael D. Lowis <mike.lowis@gentex.com>
Tue, 8 Jan 2019 02:04:38 +0000 (21:04 -0500)
committerMichael D. Lowis <mike.lowis@gentex.com>
Tue, 8 Jan 2019 02:04:38 +0000 (21:04 -0500)
config.mk
src/lib/x11_gc.c
src/tide.c

index 4b9626da2e7b8cd2b6a81e2215f419bf9571bf13..1d0680a5025b6a2d1154e24ded846c9305980379 100644 (file)
--- a/config.mk
+++ b/config.mk
@@ -31,30 +31,18 @@ LDFLAGS = $(LIBS) -lX11 -lXft -lfontconfig -lXinerama -lutil -lm
 AR = ar
 ARFLAGS = rcs
 
-# Enable Sanitizers
+# Clang - Enable Sanitizers
 #CFLAGS += -g -fsanitize=address,undefined
 #LDFLAGS += -g -fsanitize=address,undefined
 
-# Set the variables below or set them on the command line to enable the
-# corresponding feature
-DEBUG  = 0
-GPROF  = 0
-GCOV   = 0
-
-# GCC Debugging
-ifeq ($(DEBUG), 1)
-    CFLAGS  += -g -O0
-    LDFLAGS += -g -O0
-endif
-
-# GCC Profiling
-ifeq ($(GPROF), 1)
-    CFLAGS  += -pg
-    LDFLAGS += -pg
-endif
-
-# GCC Coverage
-ifeq ($(GCOV), 1)
-    CFLAGS  += --coverage
-    LDFLAGS += --coverage
-endif
+# GCC - Enable Sanitizers
+#CFLAGS += -g -fsanitize=address,leak,undefined
+#LDFLAGS += -g -fsanitize=address,leak,undefined -lasan
+
+# GCC/Clang Profiling
+#CFLAGS  += -pg
+#LDFLAGS += -pg
+
+# GCC/Clang Coverage
+#CFLAGS  += -g O0 --coverage
+#LDFLAGS += -g O0 --coverage
index b0c689724fb6c7c4816fe776548fe2429d982846..2d59a2210b0ad58b2fb61ddfa618ea727c9f58ff 100644 (file)
@@ -49,6 +49,7 @@ void x11_centerwin(XConf* x) {
             break;
         }
     }
+    if (p_screens) XFree(p_screens);
 }
 
 void x11_show(XConf* x) {
index f5ab85a0df2d565f00bd4cc8a1fe18a35ff2d22a..e130204940ab276282c1b21a3c9cdcc92db2b825 100644 (file)
@@ -150,9 +150,8 @@ static void mouse_right(WinRegion id, bool pressed, size_t row, size_t col) {
             SearchTerm = view_fetch(win_view(id), row, col, risfile);
             view_findstr(win_view(EDIT), SearchDir, SearchTerm);
             SyncMouse = true;
-        } else {
-            free(FetchCmd[1]);
         }
+        free(FetchCmd[1]);
     }
 }
 
@@ -246,7 +245,8 @@ static void xupdate(Job* job) {
     int nevents, nqueued;
     do {
         nqueued = XEventsQueued(X.display, QueuedAfterFlush);
-        XGetMotionEvents(X.display, X.self, CurrentTime, CurrentTime, &nevents);
+        XTimeCoord* coords = XGetMotionEvents(X.display, X.self, CurrentTime, CurrentTime, &nevents);
+        if (coords) XFree(coords);
         for (XEvent e; XPending(X.display);) {
             XNextEvent(X.display, &e);
             if (!XFilterEvent(&e, None) && X.eventfns[e.type])
@@ -895,11 +895,12 @@ int main(int argc, char** argv) {
     /* if we still have args left we're going to open it in this instance */
     if (*argv) {
         char* path = realpath(*argv, NULL);
-        if (!path) path = *argv; /* if file doesnt exist, use the original name */
+        if (!path) path = strdup(*argv); /* if file doesnt exist, use the original name */
         view_init(win_view(EDIT), path);
         view_setln(win_view(EDIT), line_num);
         win_title(path);
         win_prop_set("FILE", "file", path);
+        free(path);
     }
 
     /* now create the window and start the event loop */