summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/main.c5
-rw-r--r--src/core/manager.c6
-rw-r--r--src/core/manager.h2
3 files changed, 6 insertions, 7 deletions
diff --git a/src/core/main.c b/src/core/main.c
index 64acdf76e1..b44e7f9cdd 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1799,10 +1799,7 @@ int main(int argc, char *argv[]) {
finish:
pager_close();
- if (m) {
- manager_free(m);
- m = NULL;
- }
+ m = manager_free(m);
for (j = 0; j < ELEMENTSOF(arg_default_rlimit); j++) {
free(arg_default_rlimit[j]);
diff --git a/src/core/manager.c b/src/core/manager.c
index 7abc8a9a5e..4c3264b373 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -889,11 +889,12 @@ static void manager_clear_jobs_and_units(Manager *m) {
m->n_running_jobs = 0;
}
-void manager_free(Manager *m) {
+Manager* manager_free(Manager *m) {
UnitType c;
int i;
- assert(m);
+ if (!m)
+ return NULL;
manager_clear_jobs_and_units(m);
@@ -955,6 +956,7 @@ void manager_free(Manager *m) {
hashmap_free(m->units_requiring_mounts_for);
free(m);
+ return NULL;
}
int manager_enumerate(Manager *m) {
diff --git a/src/core/manager.h b/src/core/manager.h
index ab7254849c..02535023a3 100644
--- a/src/core/manager.h
+++ b/src/core/manager.h
@@ -296,7 +296,7 @@ struct Manager {
};
int manager_new(SystemdRunningAs running_as, bool test_run, Manager **m);
-void manager_free(Manager *m);
+Manager* manager_free(Manager *m);
int manager_enumerate(Manager *m);
int manager_startup(Manager *m, FILE *serialization, FDSet *fds);