diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-10-11 19:33:43 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-10-13 17:56:54 -0400 |
commit | a3e7f417d72ba3251fd6b3a228a2721a4b725a03 (patch) | |
tree | d9747bb30dfb6d9bd54ddec31198aa6fb1da9703 /src/machine/machined-dbus.c | |
parent | 6891529fe1176c046ece579807ff48e3191692f3 (diff) |
bus: fix access to unitialized variable in error path
src/machine/machined-dbus.c:237:13: warning: Branch condition evaluates to a garbage value
if (m)
^
Diffstat (limited to 'src/machine/machined-dbus.c')
-rw-r--r-- | src/machine/machined-dbus.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/machine/machined-dbus.c b/src/machine/machined-dbus.c index 22caadfceb..2b622d1793 100644 --- a/src/machine/machined-dbus.c +++ b/src/machine/machined-dbus.c @@ -203,7 +203,7 @@ static int bus_manager_create_machine(Manager *manager, DBusMessage *message) { r = manager_add_machine(manager, name, &m); if (r < 0) - goto fail; + return r; m->leader = leader; m->class = c; @@ -234,8 +234,7 @@ static int bus_manager_create_machine(Manager *manager, DBusMessage *message) { return 0; fail: - if (m) - machine_add_to_gc_queue(m); + machine_add_to_gc_queue(m); return r; } @@ -1003,17 +1002,12 @@ int manager_add_machine(Manager *m, const char *name, Machine **_machine) { assert(name); machine = hashmap_get(m->machines, name); - if (machine) { - if (_machine) - *_machine = machine; - - return 0; + if (!machine) { + machine = machine_new(m, name); + if (!machine) + return -ENOMEM; } - machine = machine_new(m, name); - if (!machine) - return -ENOMEM; - if (_machine) *_machine = machine; |