Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: possible memory leak in expandcmdpath



There are 60 other potential leaks identified by the source code
scanner.  I have no idea if any of them are significant.

Index: Src/Zle/zle_tricky.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_tricky.c,v
retrieving revision 1.95
diff -u -r1.95 zle_tricky.c
--- Src/Zle/zle_tricky.c	16 May 2008 09:37:56 -0000	1.95
+++ Src/Zle/zle_tricky.c	8 Sep 2008 22:11:02 -0000
@@ -2834,8 +2834,14 @@
     noaliases = 1;
     s = getcurcmd();
     noaliases = na;
-    if (!s || cmdwb < 0 || cmdwe < cmdwb)
+    if (!s)
 	return 1;
+
+    if (cmdwb < 0 || cmdwe < cmdwb) {
+	zsfree(s);
+	return 1;
+    }
+
     str = findcmd(s, 1);
     zsfree(s);
     if (!str)



Messages sorted by: Reverse Date, Date, Thread, Author