summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2012-09-16 15:09:47 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2012-09-16 16:20:09 +0200
commit6b2d0e85dce8762d6d65a97c7c7ae5e81806fe3e (patch)
treee851edfda6d1821e31032732c1d2ee947ee5150c /src
parentede89845a49c735fa9e8a04bd80f6e94ea84aeb9 (diff)
nspawn: use automatic cleanup
This one actually clears up a (totally harmless) memleak.
Diffstat (limited to 'src')
-rw-r--r--src/nspawn/nspawn.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 770019bb8a..c46f63ba29 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -46,6 +46,7 @@
#include "log.h"
#include "util.h"
#include "mkdir.h"
+#include "macro.h"
#include "audit.h"
#include "missing.h"
#include "cgroup-util.h"
@@ -283,7 +284,7 @@ static int mount_all(const char *dest) {
unsigned k;
int r = 0;
- char *where;
+ char _cleanup_free_ *where = NULL;
for (k = 0; k < ELEMENTSOF(mount_table); k++) {
int t;
@@ -300,7 +301,6 @@ static int mount_all(const char *dest) {
t = path_is_mount_point(where, true);
if (t < 0) {
log_error("Failed to detect whether %s is a mount point: %s", where, strerror(-t));
- free(where);
if (r == 0)
r = t;
@@ -326,8 +326,6 @@ static int mount_all(const char *dest) {
if (r == 0)
r = -errno;
}
-
- free(where);
}
return r;