chiark / gitweb /
nspawn: fix memleak introduced with automatic cleanup
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 16 Sep 2012 14:33:20 +0000 (16:33 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 16 Sep 2012 14:33:20 +0000 (16:33 +0200)
6b2d0e8 introduced a memleak instead of fixing one.
Fix both.

src/nspawn/nspawn.c

index b494045..ab7a239 100644 (file)
@@ -284,9 +284,9 @@ static int mount_all(const char *dest) {
 
         unsigned k;
         int r = 0;
-        char _cleanup_free_ *where = NULL;
 
         for (k = 0; k < ELEMENTSOF(mount_table); k++) {
+                char _cleanup_free_ *where = NULL;
                 int t;
 
                 if (asprintf(&where, "%s/%s", dest, mount_table[k].where) < 0) {