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

PATCH: potential memory leak in getsubsargs



ptr2 gets allocated by hdynread2() above, but does not get used if
(!hsub1).

Index: Src/hist.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/hist.c,v
retrieving revision 1.82
diff -u -r1.82 hist.c
--- Src/hist.c	4 Sep 2008 22:27:59 -0000	1.82
+++ Src/hist.c	10 Sep 2008 18:53:22 -0000
@@ -346,8 +346,10 @@
     if (strlen(ptr1)) {
 	zsfree(hsubl);
 	hsubl = ptr1;
-    } else if (!hsubl)		/* fail silently on this */
+    } else if (!hsubl) {		/* fail silently on this */
+	zsfree(ptr2);
 	return 0;
+    }
     zsfree(hsubr);
     hsubr = ptr2;
     follow = ingetc();



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