1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

r6075: added talloc_enable_null_tracking() (asked for by lifeless)

(This used to be commit 40b8ee186af3e7f771c680dbbb03fdcf559bf103)
This commit is contained in:
Andrew Tridgell 2005-03-26 10:47:44 +00:00 committed by Gerald (Jerry) Carter
parent 0c936acc47
commit 0d36266cd4
3 changed files with 21 additions and 2 deletions

View File

@ -811,12 +811,22 @@ static void talloc_report_null_full(void)
}
}
/*
enable tracking of the NULL context
*/
void talloc_enable_null_tracking(void)
{
if (null_context == NULL) {
null_context = talloc_named_const(NULL, 0, "null_context");
}
}
/*
enable leak reporting on exit
*/
void talloc_enable_leak_report(void)
{
null_context = talloc_named_const(NULL, 0, "null_context");
talloc_enable_null_tracking();
atexit(talloc_report_null);
}
@ -825,7 +835,7 @@ void talloc_enable_leak_report(void)
*/
void talloc_enable_leak_report_full(void)
{
null_context = talloc_named_const(NULL, 0, "null_context");
talloc_enable_null_tracking();
atexit(talloc_report_null_full);
}

View File

@ -110,6 +110,7 @@ off_t talloc_total_size(const void *ptr);
off_t talloc_total_blocks(const void *ptr);
void talloc_report_full(const void *ptr, FILE *f);
void talloc_report(const void *ptr, FILE *f);
void talloc_enable_null_tracking(void);
void talloc_enable_leak_report(void);
void talloc_enable_leak_report_full(void);
void *_talloc_zero(const void *ctx, size_t size, const char *name);

View File

@ -408,6 +408,14 @@ full talloc report on 'root' (total 18 bytes in 8 blocks)
x1 contains 1 bytes in 1 blocks (ref 0)
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
void talloc_enable_null_tracking(void);
This enables tracking of the NULL memory context without enabling leak
reporting on exit. Useful for when you want to do your own leak
reporting call via talloc_report_null_full();
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
(type *)talloc_zero(const void *ctx, type);