Blob Blame Raw
From f0bb84f7db0af57520521846ff782871fbbd6020 Mon Sep 17 00:00:00 2001
From: cee1 <fykcee1@gmail.com>
Date: Thu, 9 Jul 2015 13:52:16 +0800
Subject: [PATCH 06/47] basic/util.c fopen_temporary(): close fd if failed

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

diff --git a/src/basic/util.c b/src/basic/util.c
index aa912bd..100facb 100644
--- a/src/basic/util.c
+++ b/src/basic/util.c
@@ -2535,6 +2535,7 @@ int fopen_temporary(const char *path, FILE **_f, char **_temp_path) {
         if (!f) {
                 unlink(t);
                 free(t);
+                safe_close(fd);
                 return -errno;
         }
 
-- 
2.5.0