From ee05daab924cc80adbfb26599fc1ad6ba6197dc5 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@telfort.nl>
Date: Sun, 2 Feb 2020 11:08:59 +0100
Subject: [PATCH] tweaks: do not leak a file descriptor when fdopen() fails

---
 src/files.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/files.c b/src/files.c
index dab30f28..e1127858 100644
--- a/src/files.c
+++ b/src/files.c
@@ -211,6 +211,7 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
 	if (filestream == NULL) {
 		statusline(MILD, _("Error writing lock file %s: %s"),
 							lockfilename, strerror(errno));
+		close(fd);
 		goto free_the_data;
 	}