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

PATCH: memory leak / file handle left open in bin_print



Index: Src/builtin.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v
retrieving revision 1.212
diff -u -r1.212 builtin.c
--- Src/builtin.c	14 Oct 2008 21:47:52 -0000	1.212
+++ Src/builtin.c	18 Oct 2008 14:00:57 -0000
@@ -3689,8 +3689,11 @@
     if (OPT_ISSET(ops,'o') || OPT_ISSET(ops,'O')) {
 	int flags;
 
-	if (fmt && !*args)
+	if (fmt && !*args) {
+	    if (fout != stdout)
+	        fclose(fout);
 	    return 0;
+	}
 	flags = OPT_ISSET(ops,'i') ? SORTIT_IGNORING_CASE : 0;
 	if (OPT_ISSET(ops,'O'))
 	    flags |= SORTIT_BACKWARDS;



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