]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
basic/util.c fopen_temporary(): close fd if failed
authorcee1 <fykcee1@gmail.com>
Thu, 9 Jul 2015 05:52:16 +0000 (13:52 +0800)
committerDaniel Mack <daniel@zonque.org>
Thu, 9 Jul 2015 14:41:23 +0000 (10:41 -0400)
src/basic/util.c

index e4e302ae3d82c91ad314d07509e03d6b3a483862..c88cd1d38a350a04f18bc56c402ce17a195e30da 100644 (file)
@@ -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;
         }