talloc: a useful bit of debug code
authorAndrew Tridgell <tridge@samba.org>
Fri, 2 Apr 2010 07:18:53 +0000 (18:18 +1100)
committerAndrew Tridgell <tridge@samba.org>
Fri, 2 Apr 2010 07:52:29 +0000 (18:52 +1100)
this is useful when tracking down talloc loops. It is probably too
expensive to have on by default.

lib/talloc/talloc.c

index 51273dd6126904d62ada490b9ab26d73e70b1e06..bc1c6977895564edaa046595b4a40729ab535e45 100644 (file)
@@ -754,6 +754,14 @@ void *_talloc_steal_loc(const void *new_ctx, const void *ptr, const char *locati
                                   h->location);
                }
        }
+
+#if 0
+       /* this test is probably too expensive to have on in the
+          normal build, but it useful for debugging */
+       if (talloc_is_parent(new_ctx, ptr)) {
+               talloc_log("WARNING: stealing into talloc child at %s\n", location);
+       }
+#endif
        
        return _talloc_steal_internal(new_ctx, ptr);
 }