systemd: fix segv in snapshot creation
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 7 Aug 2013 01:30:34 +0000 (21:30 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 7 Aug 2013 01:30:48 +0000 (21:30 -0400)
https://bugs.freedesktop.org/show_bug.cgi?id=67848

src/core/snapshot.c

index 1423854..d11239d 100644 (file)
@@ -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;