summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
Diffstat (limited to 'Src')
-rw-r--r--Src/builtin.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index 0748eaccc..72c519037 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -1480,6 +1480,7 @@ bin_fc(char *nam, char **argv, Options ops, int func)
 		    unqueue_signals();
 		    zwarnnam("fc",
 		      "current history line would recurse endlessly, aborted");
+		    fclose(out);
 		    unlink(fil);
 		    return 1;
 		}
@@ -1619,6 +1620,8 @@ fclist(FILE *f, Options ops, zlong first, zlong last,
 	    zwarnnam("fc", "no such event: %s", buf);
 	} else
 	    zwarnnam("fc", "no events in that range");
+	if (f != stdout)
+	    fclose(f);
 	return 1;
     }