summaryrefslogtreecommitdiffstats
path: root/src/basic/mempool.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2023-02-14 13:42:03 +0100
committerLennart Poettering <lennart@poettering.net>2023-02-17 15:03:10 +0100
commit4392b983b8e765a25c7bf081c06e8ecc37425274 (patch)
tree393386f54a5cbbe6ec4c878a50cf9c9eb37a32b3 /src/basic/mempool.c
parentmempool: introduce new helper pool_ptr() (diff)
downloadsystemd-4392b983b8e765a25c7bf081c06e8ecc37425274.tar.xz
systemd-4392b983b8e765a25c7bf081c06e8ecc37425274.zip
mempool: make mempool_free_tile() return NULL
To match how we usually do this current allocation code. (Also, make it accept a NULL pointer, also in order to match behaviour in the rest of our codebase)
Diffstat (limited to 'src/basic/mempool.c')
-rw-r--r--src/basic/mempool.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/basic/mempool.c b/src/basic/mempool.c
index d934aa9547..999b86d5cb 100644
--- a/src/basic/mempool.c
+++ b/src/basic/mempool.c
@@ -70,9 +70,16 @@ void* mempool_alloc0_tile(struct mempool *mp) {
return p;
}
-void mempool_free_tile(struct mempool *mp, void *p) {
- * (void**) p = mp->freelist;
+void* mempool_free_tile(struct mempool *mp, void *p) {
+ assert(mp);
+
+ if (!p)
+ return NULL;
+
+ *(void**) p = mp->freelist;
mp->freelist = p;
+
+ return NULL;
}
void mempool_drop(struct mempool *mp) {