mirror of
https://github.com/systemd/systemd.git
synced 2025-01-12 13:18:14 +03:00
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) ^
This commit is contained in:
parent
6891529fe1
commit
a3e7f417d7
@ -639,7 +639,6 @@ int sd_bus_message_new_method_errorf(
|
||||
const char *format,
|
||||
...) {
|
||||
|
||||
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
|
||||
sd_bus_message *t;
|
||||
va_list ap;
|
||||
int r;
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user