ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
Harald Hoyer fe20ad
From 2c853443d3518f638b58f30cd866ca2d4c401281 Mon Sep 17 00:00:00 2001
Harald Hoyer fe20ad
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Harald Hoyer fe20ad
Date: Tue, 6 Aug 2013 21:30:34 -0400
Harald Hoyer fe20ad
Subject: [PATCH] systemd: fix segv in snapshot creation
Harald Hoyer fe20ad
Harald Hoyer fe20ad
https://bugs.freedesktop.org/show_bug.cgi?id=67848
Harald Hoyer fe20ad
---
Harald Hoyer fe20ad
 src/core/snapshot.c | 4 +++-
Harald Hoyer fe20ad
 1 file changed, 3 insertions(+), 1 deletion(-)
Harald Hoyer fe20ad
Harald Hoyer fe20ad
diff --git a/src/core/snapshot.c b/src/core/snapshot.c
Harald Hoyer fe20ad
index 1423854..d11239d 100644
Harald Hoyer fe20ad
--- a/src/core/snapshot.c
Harald Hoyer fe20ad
+++ b/src/core/snapshot.c
Harald Hoyer fe20ad
@@ -221,8 +221,10 @@ int snapshot_create(Manager *m, const char *name, bool cleanup, DBusError *e, Sn
Harald Hoyer fe20ad
                         if (asprintf(&n, "snapshot-%u.snapshot", ++ m->n_snapshots) < 0)
Harald Hoyer fe20ad
                                 return -ENOMEM;
Harald Hoyer fe20ad
 
Harald Hoyer fe20ad
-                        if (!manager_get_unit(m, n))
Harald Hoyer fe20ad
+                        if (!manager_get_unit(m, n)) {
Harald Hoyer fe20ad
+                                name = n;
Harald Hoyer fe20ad
                                 break;
Harald Hoyer fe20ad
+                        }
Harald Hoyer fe20ad
 
Harald Hoyer fe20ad
                         free(n);
Harald Hoyer fe20ad
                         n = NULL;