mirror of
https://github.com/systemd/systemd.git
synced 2024-11-08 11:27:32 +03:00
Merge pull request #976 from elfring/Remove_unnecessary_checks2
Delete unnecessary checks before some function calls
This commit is contained in:
commit
aaa2a3abf9
@ -252,8 +252,7 @@ static int bus_timer_set_transient_property(
|
||||
|
||||
v = new0(TimerValue, 1);
|
||||
if (!v) {
|
||||
if (c)
|
||||
calendar_spec_free(c);
|
||||
calendar_spec_free(c);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
|
@ -56,10 +56,7 @@ void timer_free_values(Timer *t) {
|
||||
|
||||
while ((v = t->values)) {
|
||||
LIST_REMOVE(value, t->values, v);
|
||||
|
||||
if (v->calendar_spec)
|
||||
calendar_spec_free(v->calendar_spec);
|
||||
|
||||
calendar_spec_free(v->calendar_spec);
|
||||
free(v);
|
||||
}
|
||||
}
|
||||
|
@ -103,8 +103,7 @@ static void request_meta_free(
|
||||
if (!m)
|
||||
return;
|
||||
|
||||
if (m->journal)
|
||||
sd_journal_close(m->journal);
|
||||
sd_journal_close(m->journal);
|
||||
|
||||
if (m->tmp)
|
||||
fclose(m->tmp);
|
||||
|
@ -169,7 +169,7 @@ void journal_file_close(JournalFile *f) {
|
||||
#ifdef HAVE_GCRYPT
|
||||
if (f->fss_file)
|
||||
munmap(f->fss_file, PAGE_ALIGN(f->fss_file_size));
|
||||
else if (f->fsprg_state)
|
||||
else
|
||||
free(f->fsprg_state);
|
||||
|
||||
free(f->fsprg_seed);
|
||||
|
@ -1689,6 +1689,5 @@ void server_done(Server *s) {
|
||||
if (s->mmap)
|
||||
mmap_cache_unref(s->mmap);
|
||||
|
||||
if (s->udev)
|
||||
udev_unref(s->udev);
|
||||
udev_unref(s->udev);
|
||||
}
|
||||
|
@ -143,11 +143,7 @@ static void message_free(sd_bus_message *m) {
|
||||
if (m->iovec != m->iovec_fixed)
|
||||
free(m->iovec);
|
||||
|
||||
if (m->destination_ptr) {
|
||||
free(m->destination_ptr);
|
||||
m->destination_ptr = NULL;
|
||||
}
|
||||
|
||||
m->destination_ptr = mfree(m->destination_ptr);
|
||||
message_reset_containers(m);
|
||||
free(m->root_container.signature);
|
||||
free(m->root_container.offsets);
|
||||
|
@ -118,9 +118,7 @@ static int server_init(sd_bus **_bus) {
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
if (bus)
|
||||
sd_bus_unref(bus);
|
||||
|
||||
sd_bus_unref(bus);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -153,17 +153,12 @@ static void manager_free(Manager *m) {
|
||||
|
||||
safe_close(m->console_active_fd);
|
||||
|
||||
if (m->udev_seat_monitor)
|
||||
udev_monitor_unref(m->udev_seat_monitor);
|
||||
if (m->udev_device_monitor)
|
||||
udev_monitor_unref(m->udev_device_monitor);
|
||||
if (m->udev_vcsa_monitor)
|
||||
udev_monitor_unref(m->udev_vcsa_monitor);
|
||||
if (m->udev_button_monitor)
|
||||
udev_monitor_unref(m->udev_button_monitor);
|
||||
udev_monitor_unref(m->udev_seat_monitor);
|
||||
udev_monitor_unref(m->udev_device_monitor);
|
||||
udev_monitor_unref(m->udev_vcsa_monitor);
|
||||
udev_monitor_unref(m->udev_button_monitor);
|
||||
|
||||
if (m->udev)
|
||||
udev_unref(m->udev);
|
||||
udev_unref(m->udev);
|
||||
|
||||
if (m->unlink_nologin)
|
||||
(void) unlink("/run/nologin");
|
||||
@ -1170,8 +1165,7 @@ finish:
|
||||
"STOPPING=1\n"
|
||||
"STATUS=Shutting down...");
|
||||
|
||||
if (m)
|
||||
manager_free(m);
|
||||
manager_free(m);
|
||||
|
||||
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||
}
|
||||
|
@ -355,8 +355,7 @@ int main(int argc, char *argv[]) {
|
||||
log_debug("systemd-machined stopped as pid "PID_FMT, getpid());
|
||||
|
||||
finish:
|
||||
if (m)
|
||||
manager_free(m);
|
||||
manager_free(m);
|
||||
|
||||
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||
}
|
||||
|
@ -176,8 +176,7 @@ static int manager_process_address(sd_netlink *rtnl, sd_netlink_message *mm, voi
|
||||
break;
|
||||
|
||||
case RTM_DELADDR:
|
||||
if (a)
|
||||
link_address_free(a);
|
||||
link_address_free(a);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -117,8 +117,7 @@ static struct udev_device *handle_scsi_fibre_channel(struct udev_device *parent,
|
||||
|
||||
format_lun_number(parent, &lun);
|
||||
path_prepend(path, "fc-%s-%s", port, lun);
|
||||
if (lun)
|
||||
free(lun);
|
||||
free(lun);
|
||||
out:
|
||||
udev_device_unref(fcdev);
|
||||
return parent;
|
||||
@ -156,8 +155,7 @@ static struct udev_device *handle_scsi_sas_wide_port(struct udev_device *parent,
|
||||
|
||||
format_lun_number(parent, &lun);
|
||||
path_prepend(path, "sas-%s-%s", sas_address, lun);
|
||||
if (lun)
|
||||
free(lun);
|
||||
free(lun);
|
||||
out:
|
||||
udev_device_unref(sasdev);
|
||||
return parent;
|
||||
@ -251,8 +249,7 @@ static struct udev_device *handle_scsi_sas(struct udev_device *parent, char **pa
|
||||
else
|
||||
path_prepend(path, "sas-phy%s-%s", phy_id, lun);
|
||||
|
||||
if (lun)
|
||||
free(lun);
|
||||
free(lun);
|
||||
out:
|
||||
udev_device_unref(target_sasdev);
|
||||
udev_device_unref(expander_sasdev);
|
||||
@ -313,8 +310,7 @@ static struct udev_device *handle_scsi_iscsi(struct udev_device *parent, char **
|
||||
|
||||
format_lun_number(parent, &lun);
|
||||
path_prepend(path, "ip-%s:%s-iscsi-%s-%s", addr, port, target, lun);
|
||||
if (lun)
|
||||
free(lun);
|
||||
free(lun);
|
||||
out:
|
||||
udev_device_unref(sessiondev);
|
||||
udev_device_unref(conndev);
|
||||
|
@ -286,8 +286,6 @@ finish:
|
||||
audit_close(c.audit_fd);
|
||||
#endif
|
||||
|
||||
if (c.bus)
|
||||
sd_bus_unref(c.bus);
|
||||
|
||||
sd_bus_unref(c.bus);
|
||||
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user