From: Thomas Jarosch Date: Tue, 25 Dec 2012 12:46:46 +0000 (+0100) Subject: tmpfiles: Fix file descriptor leak on error X-Git-Tag: v197~72 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=3785ba6966c6f42ed1109bd238f001862736ff73;ds=sidebyside tmpfiles: Fix file descriptor leak on error Detected by cppcheck --- diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index c27d0112f..d8fb07e59 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);