core/namespace: use free_and_replace()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 12 Feb 2018 05:27:49 +0000 (14:27 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 21 Feb 2018 00:05:21 +0000 (09:05 +0900)
src/core/namespace.c

index 058b691..5dd2cc7 100644 (file)
@@ -365,9 +365,7 @@ static int prefix_where_needed(MountEntry *m, unsigned n, const char *root_direc
                 if (!s)
                         return -ENOMEM;
 
-                free(m[i].path_malloc);
-                m[i].path_malloc = s;
-
+                free_and_replace(m[i].path_malloc, s);
                 m[i].has_prefix = true;
         }