talloc: Do an early return
[metze/samba/wip.git] / lib / talloc / talloc.c
index 011e8f33436786e2354642a371780323206e3ef0..0078b07ca67f7353deb6bd66888913444c78515e 100644 (file)
@@ -931,10 +931,13 @@ static inline int _talloc_free_internal(void *ptr, const char *location)
                }
 
                pool->hdr.object_count--;
-               if (unlikely(pool->hdr.object_count == 0)) {
-                       TC_INVALIDATE_FULL_CHUNK(tc);
-                       free(tc);
+
+               if (likely(pool->hdr.object_count != 0)) {
+                       return 0;
                }
+
+               TC_INVALIDATE_FULL_CHUNK(tc);
+               free(tc);
                return 0;
        }