summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2013-04-15 22:19:25 +0200
committerKarolin Seeger <kseeger@samba.org>2015-03-15 22:14:07 +0100
commit993537655626a419d1bb7335e5fa28226905d3af (patch)
tree2f23d6e418ba208d2e8ec172dbdf30fbd5b542ab
parent18285059101b34d125149602954c105dcb0d8e7e (diff)
downloadsamba-993537655626a419d1bb7335e5fa28226905d3af.tar.gz
talloc: Simplify _talloc_free_poolmem a bit
Early returns are easier to understand than "else if" Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Thu Apr 18 22:50:42 CEST 2013 on sn-devel-104 (cherry picked from commit 79fe1381a3a78ad2316343fc8c1c27360b46ebbf)
-rw-r--r--lib/talloc/talloc.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/talloc/talloc.c b/lib/talloc/talloc.c
index 0078b07ca67..885d7006e65 100644
--- a/lib/talloc/talloc.c
+++ b/lib/talloc/talloc.c
@@ -794,7 +794,10 @@ static inline void _talloc_free_poolmem(struct talloc_chunk *tc,
*/
pool->hdr.c.pool = tc_pool_first_chunk(pool);
tc_invalidate_pool(pool);
- } else if (unlikely(pool->hdr.object_count == 0)) {
+ return;
+ }
+
+ if (unlikely(pool->hdr.object_count == 0)) {
/*
* we mark the freed memory with where we called the free
* from. This means on a double free error we can report where
@@ -804,14 +807,23 @@ static inline void _talloc_free_poolmem(struct talloc_chunk *tc,
TC_INVALIDATE_FULL_CHUNK(&pool->hdr.c);
free(pool);
- } else if (pool->hdr.c.pool == next_tc) {
+ return;
+ }
+
+ if (pool->hdr.c.pool == next_tc) {
/*
* if pool->pool still points to end of
* 'tc' (which is stored in the 'next_tc' variable),
* we can reclaim the memory of 'tc'.
*/
pool->hdr.c.pool = tc;
+ return;
}
+
+ /*
+ * Do nothing. The memory is just "wasted", waiting for the pool
+ * itself to be freed.
+ */
}
static inline void _talloc_free_children_internal(struct talloc_chunk *tc,