chiark / gitweb /
tmpfiles: Fix file descriptor leak on error
[elogind.git] / src / tmpfiles / tmpfiles.c
index c27d0112f9d00a271578165fd79cd98ea2d2dea5..d8fb07e59a1e0008bfc62915be066274da730a14 100644 (file)
@@ -507,8 +507,10 @@ static int write_one_file(Item *i, const char *path) {
                 _cleanup_free_ char *unescaped;
 
                 unescaped = cunescape(i->argument);
-                if (unescaped == NULL)
+                if (unescaped == NULL) {
+                        close_nointr_nofail(fd);
                         return log_oom();
+                }
 
                 l = strlen(unescaped);
                 n = write(fd, unescaped, l);