talloc: call return after abort, because an overloaded abort function might not exit
authorStefan Metzmacher <metze@samba.org>
Tue, 14 Jul 2009 09:56:33 +0000 (11:56 +0200)
committerAndrew Tridgell <tridge@samba.org>
Mon, 24 Aug 2009 06:29:57 +0000 (16:29 +1000)
This will be useful in the testsuite,
where we could check if an abort would happen.

metze

lib/talloc/talloc.c

index a65a69b4e21942d378a8ccb360a5c2bc0235edb8..a0065bccabb3f3b3980458a7c5ae95c1a6cf8a6a 100644 (file)
@@ -180,12 +180,15 @@ static inline struct talloc_chunk *talloc_chunk_from_ptr(const void *ptr)
        if (unlikely((tc->flags & (TALLOC_FLAG_FREE | ~0xF)) != TALLOC_MAGIC)) { 
                if ((tc->flags & (~0xF)) == TALLOC_MAGIC_V1) {
                        talloc_abort_magic_v1();
+                       return NULL;
                }
 
                if (tc->flags & TALLOC_FLAG_FREE) {
                        talloc_abort_double_free();
+                       return NULL;
                } else {
                        talloc_abort_unknown_value();
+                       return NULL;
                }
        }
        return tc;
@@ -595,6 +598,7 @@ static inline int _talloc_free_internal(void *ptr)
 
                if (*pool_object_count == 0) {
                        talloc_abort("Pool object count zero!");
+                       return 0;
                }
 
                *pool_object_count -= 1;