tree-wide: return NULL from freeing functions

I started working on this because I wanted to change how
DEFINE_TRIVIAL_CLEANUP_FUNC is defined. Even independently of that change, it's
nice to make make things more consistent and predictable.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2021-02-16 17:15:10 +01:00
parent 5d160a2304
commit 75db809ae5
52 changed files with 154 additions and 165 deletions
+4 -3
View File
@@ -210,8 +210,9 @@ static int fifo_process(Fifo *f) {
return 0;
}
static void fifo_free(Fifo *f) {
assert(f);
static Fifo* fifo_free(Fifo *f) {
if (!f)
return NULL;
if (f->server) {
assert(f->server->n_fifos > 0);
@@ -226,7 +227,7 @@ static void fifo_free(Fifo *f) {
safe_close(f->fd);
}
free(f);
return mfree(f);
}
DEFINE_TRIVIAL_CLEANUP_FUNC(Fifo*, fifo_free);