[systemd-commits] src/tmpfiles

Lennart Poettering lennart at kemper.freedesktop.org
Thu Jan 3 13:43:11 PST 2013


 src/tmpfiles/tmpfiles.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 3785ba6966c6f42ed1109bd238f001862736ff73
Author: Thomas Jarosch <thomas.jarosch at intra2net.com>
Date:   Tue Dec 25 13:46:46 2012 +0100

    tmpfiles: Fix file descriptor leak on error
    
    Detected by cppcheck

diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index c27d011..d8fb07e 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -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);



More information about the systemd-commits mailing list