diff options
author | Vadim Yanitskiy <axilirator@gmail.com> | 2018-07-30 03:09:22 +0700 |
---|---|---|
committer | Vadim Yanitskiy <axilirator@gmail.com> | 2018-07-30 04:11:20 +0700 |
commit | 9fdb85417467d85ab213f5e689b8693ebdb81f7f (patch) | |
tree | 3e8d819677c5d0e73408331a0b3dcbd2504815d6 /src | |
parent | 4793a7efc34e1e5945b8adc7ee344406db61fd53 (diff) |
hlr.c: track the use of talloc NULL memory contexts
Tracking NULL memory contexts allows one to detect memory chunks
allocated outside the application's root context, which in most
cases are the result of some mistake.
For example, the VTY implementation still uses the NULL context,
so we have to clean up it manually until this is fixed.
At the moment we have at least one chunk allocated outside the
application's root context (excluding the VTY context):
full talloc report on 'null_context' (total 24 bytes in 2 blocks)
struct lookup_helper contains 24 bytes in 1 blocks
Change-Id: I7ea86730e090c06b2a5966ae4d04b8144b1cd20a
Diffstat (limited to 'src')
-rw-r--r-- | src/hlr.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -551,6 +551,9 @@ int main(int argc, char **argv) { int rc; + /* Track the use of talloc NULL memory contexts */ + talloc_enable_null_tracking(); + hlr_ctx = talloc_named_const(NULL, 1, "OsmoHLR"); msgb_talloc_ctx_init(hlr_ctx, 0); vty_info.tall_ctx = hlr_ctx; @@ -632,5 +635,15 @@ int main(int argc, char **argv) talloc_report_full(hlr_ctx, stderr); talloc_free(hlr_ctx); + /* FIXME: VTY code still uses NULL-context */ + talloc_free(tall_vty_ctx); + + /** + * Report the heap state of NULL context, then free, + * so both ASAN and Valgrind are happy... + */ + talloc_report_full(NULL, stderr); + talloc_disable_null_tracking(); + return 0; } |