Use global PCU's talloc context for all talloc calls
This allows to track memory leaks of all memory that is allocated by
talloc. Especially bitvector allocations is tracked now.
diff --git a/src/pcu_main.cpp b/src/pcu_main.cpp
index 142c9f9..a9e224f 100644
--- a/src/pcu_main.cpp
+++ b/src/pcu_main.cpp
@@ -39,6 +39,7 @@
static const char *config_file = "osmo-pcu.cfg";
extern struct vty_app_info pcu_vty_info;
void *tall_pcu_ctx;
+extern void *bv_tall_ctx;
static int quit = 0;
#ifdef DEBUG_DIAGRAM
@@ -140,6 +141,7 @@
tall_pcu_ctx = talloc_named_const(NULL, 1, "Osmo-PCU context");
if (!tall_pcu_ctx)
return -ENOMEM;
+ bv_tall_ctx = tall_pcu_ctx;
bts = gprs_rlcmac_bts = talloc_zero(tall_pcu_ctx,
struct gprs_rlcmac_bts);
diff --git a/src/sysmo_l1_if.c b/src/sysmo_l1_if.c
index 7cb1d17..68881bf 100644
--- a/src/sysmo_l1_if.c
+++ b/src/sysmo_l1_if.c
@@ -14,6 +14,8 @@
#include <gprs_debug.h>
#include <pcu_l1_if.h>
+extern void *tall_pcu_ctx;
+
uint32_t l1if_ts_to_hLayer2(uint8_t trx, uint8_t ts)
{
return (ts << 16) | (trx << 24);
@@ -320,7 +322,7 @@
struct femtol1_hdl *fl1h;
int rc;
- fl1h = talloc_zero(priv, struct femtol1_hdl);
+ fl1h = talloc_zero(tall_pcu_ctx, struct femtol1_hdl);
if (!fl1h)
return NULL;