summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/snapshot.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/core/snapshot.c b/src/core/snapshot.c
index 1423854098..d11239dff3 100644
--- a/src/core/snapshot.c
+++ b/src/core/snapshot.c
@@ -221,8 +221,10 @@ int snapshot_create(Manager *m, const char *name, bool cleanup, DBusError *e, Sn
if (asprintf(&n, "snapshot-%u.snapshot", ++ m->n_snapshots) < 0)
return -ENOMEM;
- if (!manager_get_unit(m, n))
+ if (!manager_get_unit(m, n)) {
+ name = n;
break;
+ }
free(n);
n = NULL;