summaryrefslogtreecommitdiff
path: root/src/core/unit.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-11-28 19:41:20 +0100
committerLennart Poettering <lennart@poettering.net>2016-12-01 00:25:51 +0100
commitc9d5c9c0e19eea79ca0f09fe58e5c0b76b8001e2 (patch)
tree90466e55295734e2853cf570eb96d5790d8facc4 /src/core/unit.c
parentdc68fed25db7d7a84b4da0e7ed4e73152773a561 (diff)
core: make unit_free() accept NULL pointers
We generally try to make our destructors robust regarding NULL pointers, much in the same way as glibc's free(). Do this also for unit_free(). Follow-up for #4748.
Diffstat (limited to 'src/core/unit.c')
-rw-r--r--src/core/unit.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/core/unit.c b/src/core/unit.c
index cba6342eca..e485c01fc1 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -516,7 +516,8 @@ void unit_free(Unit *u) {
Iterator i;
char *t;
- assert(u);
+ if (!u)
+ return;
if (u->transient_file)
fclose(u->transient_file);