libctrl: Avoid using external tall_bsc_ctx
Instead of using one flat talloc context (and one that is specific to
openbsc), we should attach the objects to whatever parent context they
are being used in.
diff --git a/src/ctrl/control_if.c b/src/ctrl/control_if.c
index 7ce8bf6..a208071 100644
--- a/src/ctrl/control_if.c
+++ b/src/ctrl/control_if.c
@@ -96,7 +96,7 @@
{
struct ctrl_cmd *trap;
- trap = ctrl_cmd_cpy(tall_bsc_ctx, cmd);
+ trap = ctrl_cmd_cpy(cmd, cmd);
if (!trap)
return NULL;
@@ -281,10 +281,10 @@
}
}
-static char *get_all_rate_ctr_in_group(const struct rate_ctr_group *ctrg, int intv)
+static char *get_all_rate_ctr_in_group(void *ctx, const struct rate_ctr_group *ctrg, int intv)
{
int i;
- char *counters = talloc_strdup(tall_bsc_ctx, "");
+ char *counters = talloc_strdup(ctx, "");
if (!counters)
return NULL;
@@ -314,7 +314,7 @@
if (!ctrg)
break;
- counters = get_all_rate_ctr_in_group(ctrg, intv);
+ counters = get_all_rate_ctr_in_group(cmd, ctrg, intv);
if (!counters)
goto oom;
@@ -340,7 +340,7 @@
{
char *counters;
- counters = get_all_rate_ctr_in_group(ctrg, intv);
+ counters = get_all_rate_ctr_in_group(cmd, ctrg, intv);
if (!counters)
goto oom;
@@ -527,7 +527,7 @@
int ret;
struct ctrl_handle *ctrl;
- ctrl = talloc_zero(tall_bsc_ctx, struct ctrl_handle);
+ ctrl = talloc_zero(gsmnet, struct ctrl_handle);
if (!ctrl)
return NULL;