tests/sms_queue: track the use of NULL talloc memory contexts

As we don't initialize all talloc contects of libmsc, let's make
sure that there is nothing left in the NULL context after the
unit test execution is finished.

Change-Id: I99fd82750aff376e4d90eaa2402ec41f4d59ef86
This commit is contained in:
Vadim Yanitskiy 2019-03-30 15:31:47 +07:00
parent 96262a7ca6
commit 6c766c6464
2 changed files with 7 additions and 0 deletions

View File

@ -220,6 +220,9 @@ int main(int argc, char **argv)
void *msgb_ctx; void *msgb_ctx;
void *logging_ctx; void *logging_ctx;
/* Track the use of talloc NULL memory contexts */
talloc_enable_null_tracking();
talloc_ctx = talloc_named_const(NULL, 0, "sms_queue_test"); talloc_ctx = talloc_named_const(NULL, 0, "sms_queue_test");
msgb_ctx = msgb_talloc_ctx_init(talloc_ctx, 0); msgb_ctx = msgb_talloc_ctx_init(talloc_ctx, 0);
logging_ctx = talloc_named_const(talloc_ctx, 0, "logging"); logging_ctx = talloc_named_const(talloc_ctx, 0, "logging");
@ -258,6 +261,9 @@ int main(int argc, char **argv)
OSMO_ASSERT(talloc_total_size(talloc_ctx) == 0); OSMO_ASSERT(talloc_total_size(talloc_ctx) == 0);
talloc_free(talloc_ctx); talloc_free(talloc_ctx);
talloc_report_full(NULL, stderr);
talloc_disable_null_tracking();
return 0; return 0;
} }

View File

@ -0,0 +1 @@
full talloc report on 'null_context' (total 0 bytes in 1 blocks)