diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-04-27 22:03:14 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-05-03 17:19:46 +0200 |
commit | 10af01a5ff5a6ede9cc684def71508b88f6b93eb (patch) | |
tree | c8a6c75867b95e7c443810a6b9e1017d99e9257f /src/nspawn/nspawn-mount.c | |
parent | 88614c8a28a9dea6d87a74319fef1b0f2903aa1a (diff) | |
download | systemd-10af01a5ff5a6ede9cc684def71508b88f6b93eb.tar.gz |
nspawn: use free_and_replace() at more places
Diffstat (limited to 'src/nspawn/nspawn-mount.c')
-rw-r--r-- | src/nspawn/nspawn-mount.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/nspawn/nspawn-mount.c b/src/nspawn/nspawn-mount.c index 984fe2dc40..461c2707cf 100644 --- a/src/nspawn/nspawn-mount.c +++ b/src/nspawn/nspawn-mount.c @@ -133,8 +133,7 @@ int custom_mount_prepare_all(const char *dest, CustomMount *l, size_t n) { if (!s) return log_oom(); - free(m->source); - m->source = s; + free_and_replace(m->source, s); } else { /* No source specified? In that case, use a throw-away temporary directory in /var/tmp */ @@ -165,8 +164,7 @@ int custom_mount_prepare_all(const char *dest, CustomMount *l, size_t n) { if (!s) return log_oom(); - free(*j); - *j = s; + free_and_replace(*j, s); } if (m->work_dir) { @@ -176,8 +174,7 @@ int custom_mount_prepare_all(const char *dest, CustomMount *l, size_t n) { if (!s) return log_oom(); - free(m->work_dir); - m->work_dir = s; + free_and_replace(m->work_dir, s); } else { assert(m->source); |