From 71affcedba7f87183ee2bee99ada7840f2c98a01 Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 15 Jan 2018 11:03:00 +0100 Subject: Allocate global context for TypesTest Missing allocation leads to LSAN error: ==24997==ERROR: LeakSanitizer: detected memory leaks Indirect leak of 230 byte(s) in 2 object(s) allocated from: #0 0x7feaa1b2fb50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50) #1 0x7feaa13dbc80 in _talloc_zero (/usr/lib/x86_64-linux-gnu/libtalloc.so.2+0x5c80) Change-Id: I62c03dad353f459abcdb7a18a69b7782da38dfb7 SUMMARY: AddressSanitizer: 230 byte(s) leaked in 2 allocation(s). --- tests/types/TypesTest.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/types/TypesTest.cpp b/tests/types/TypesTest.cpp index ff78c870..5c4da221 100644 --- a/tests/types/TypesTest.cpp +++ b/tests/types/TypesTest.cpp @@ -481,6 +481,11 @@ static void test_lsb() int main(int argc, char **argv) { + tall_pcu_ctx = talloc_named_const(NULL, 1, "types test context"); + if (!tall_pcu_ctx) + abort(); + + msgb_talloc_ctx_init(tall_pcu_ctx, 0); osmo_init_logging(&gprs_log_info); log_set_use_color(osmo_stderr_target, 0); log_set_print_filename(osmo_stderr_target, 0); -- cgit v1.2.3