diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/automount.c | 6 | ||||
-rw-r--r-- | src/core/namespace.h | 4 | ||||
-rw-r--r-- | src/core/socket.c | 6 | ||||
-rw-r--r-- | src/core/unit.c | 8 | ||||
-rw-r--r-- | src/core/unit.h | 4 |
5 files changed, 15 insertions, 13 deletions
diff --git a/src/core/automount.c b/src/core/automount.c index 5076b351f5..f0fa5c8ca9 100644 --- a/src/core/automount.c +++ b/src/core/automount.c @@ -48,13 +48,13 @@ struct expire_data { int ioctl_fd; }; -static void expire_data_free(struct expire_data *data) { +static struct expire_data* expire_data_free(struct expire_data *data) { if (!data) - return; + return NULL; safe_close(data->dev_autofs_fd); safe_close(data->ioctl_fd); - free(data); + return mfree(data); } DEFINE_TRIVIAL_CLEANUP_FUNC(struct expire_data*, expire_data_free); diff --git a/src/core/namespace.h b/src/core/namespace.h index a4287869f7..54d4985f80 100644 --- a/src/core/namespace.h +++ b/src/core/namespace.h @@ -137,11 +137,11 @@ int setup_namespace( #define RUN_SYSTEMD_EMPTY "/run/systemd/empty" -static inline void namespace_cleanup_tmpdir(char *p) { +static inline char* namespace_cleanup_tmpdir(char *p) { PROTECT_ERRNO; if (!streq_ptr(p, RUN_SYSTEMD_EMPTY)) (void) rmdir(p); - free(p); + return mfree(p); } DEFINE_TRIVIAL_CLEANUP_FUNC(char*, namespace_cleanup_tmpdir); diff --git a/src/core/socket.c b/src/core/socket.c index cb5316af3a..5631054cce 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -969,6 +969,8 @@ static void socket_close_fds(Socket *s) { if (s->remove_on_stop) STRV_FOREACH(i, s->symlinks) (void) unlink(*i); + + /* Note that we don't return NULL here, since s has not been freed. */ } static void socket_apply_socket_options(Socket *s, SocketPort *p, int fd) { @@ -1611,8 +1613,8 @@ static int socket_address_listen_in_cgroup( DEFINE_TRIVIAL_CLEANUP_FUNC(Socket *, socket_close_fds); -static int socket_open_fds(Socket *_s) { - _cleanup_(socket_close_fdsp) Socket *s = _s; +static int socket_open_fds(Socket *orig_s) { + _cleanup_(socket_close_fdsp) Socket *s = orig_s; _cleanup_(mac_selinux_freep) char *label = NULL; bool know_label = false; SocketPort *p; diff --git a/src/core/unit.c b/src/core/unit.c index 3452712590..e9c22375dd 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -82,7 +82,7 @@ const UnitVTable * const unit_vtable[_UNIT_TYPE_MAX] = { static void maybe_warn_about_dependency(Unit *u, const char *other, UnitDependency dependency); -Unit *unit_new(Manager *m, size_t size) { +Unit* unit_new(Manager *m, size_t size) { Unit *u; assert(m); @@ -607,11 +607,11 @@ static void unit_done(Unit *u) { cgroup_context_done(cc); } -void unit_free(Unit *u) { +Unit* unit_free(Unit *u) { char *t; if (!u) - return; + return NULL; u->transient_file = safe_fclose(u->transient_file); @@ -741,7 +741,7 @@ void unit_free(Unit *u) { set_free_free(u->aliases); free(u->id); - free(u); + return mfree(u); } FreezerState unit_freezer_state(Unit *u) { diff --git a/src/core/unit.h b/src/core/unit.h index 7c13e50878..6d38e66680 100644 --- a/src/core/unit.h +++ b/src/core/unit.h @@ -674,8 +674,8 @@ static inline Unit* UNIT_TRIGGER(Unit *u) { return hashmap_first_key(u->dependencies[UNIT_TRIGGERS]); } -Unit *unit_new(Manager *m, size_t size); -void unit_free(Unit *u); +Unit* unit_new(Manager *m, size_t size); +Unit* unit_free(Unit *u); DEFINE_TRIVIAL_CLEANUP_FUNC(Unit *, unit_free); int unit_new_for_name(Manager *m, size_t size, const char *name, Unit **ret); |