summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Jarosch <thomas.jarosch@intra2net.com>2012-12-25 13:46:46 +0100
committerLennart Poettering <lennart@poettering.net>2013-01-03 22:42:55 +0100
commit3785ba6966c6f42ed1109bd238f001862736ff73 (patch)
treec9b001828b17c47e198075575ccab2451af62270 /src
parent1c981ff22e8a8ec04c2bbbe10aed0f3b4ff118bb (diff)
tmpfiles: Fix file descriptor leak on error
Detected by cppcheck
Diffstat (limited to 'src')
-rw-r--r--src/tmpfiles/tmpfiles.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index c27d0112f9..d8fb07e59a 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);