diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-02-16 13:48:04 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-02-16 17:15:10 +0100 |
commit | 75db809ae583ef7287e39738195c0825c3070843 (patch) | |
tree | 9793b944d340516003c0fc10ccb9322a4e126721 /src/basic/strbuf.c | |
parent | 5d160a23041254f58acfd35584103df57dc347ae (diff) | |
download | systemd-75db809ae583ef7287e39738195c0825c3070843.tar.gz |
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.
Diffstat (limited to 'src/basic/strbuf.c')
-rw-r--r-- | src/basic/strbuf.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/basic/strbuf.c b/src/basic/strbuf.c index aee6647e35..535ac58bed 100644 --- a/src/basic/strbuf.c +++ b/src/basic/strbuf.c @@ -26,7 +26,7 @@ * ... */ -struct strbuf *strbuf_new(void) { +struct strbuf* strbuf_new(void) { struct strbuf *str; str = new(struct strbuf, 1); @@ -65,13 +65,13 @@ void strbuf_complete(struct strbuf *str) { } /* clean up everything */ -void strbuf_cleanup(struct strbuf *str) { +struct strbuf* strbuf_cleanup(struct strbuf *str) { if (!str) - return; + return NULL; strbuf_complete(str); free(str->buf); - free(str); + return mfree(str); } static int strbuf_children_cmp(const struct strbuf_child_entry *n1, |