summaryrefslogtreecommitdiffstats
path: root/src/host/layer23/src/mobile/subscriber.c
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2017-05-17 03:17:43 +0300
committerVadim Yanitskiy <axilirator@gmail.com>2017-11-08 18:46:57 +0700
commitd0ed4de0854f16f3f03be681356755fddaf3d251 (patch)
treede945aa994d705590a3b778db736fadb68e360ad /src/host/layer23/src/mobile/subscriber.c
parent8dbacacd37e2d4810c8e0ff2008c94cc6ded0b13 (diff)
host/mobile: use osmocom_ms as talloc context
As we use talloc, it's absurdly not to use the main feature of the library - hierarchical memory management. This change sets talloc context of all sub-allocated objects to related osmocom_ms instance. So, as soon as osmocom_ms instance is destroyed, all sub-allocated chunks are getting destroyed too. Change-Id: I6e3467ff739f3e6dc8dd60cc6d1fcd3f8e490ce9
Diffstat (limited to 'src/host/layer23/src/mobile/subscriber.c')
-rw-r--r--src/host/layer23/src/mobile/subscriber.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/host/layer23/src/mobile/subscriber.c b/src/host/layer23/src/mobile/subscriber.c
index 455db506..d332a077 100644
--- a/src/host/layer23/src/mobile/subscriber.c
+++ b/src/host/layer23/src/mobile/subscriber.c
@@ -36,8 +36,6 @@
* if list is changed, the result is not written back to SIM */
//#define TEST_EMPTY_FPLMN
-void *l23_ctx;
-
static void subscr_sim_query_cb(struct osmocom_ms *ms, struct msgb *msg);
static void subscr_sim_update_cb(struct osmocom_ms *ms, struct msgb *msg);
static void subscr_sim_key_cb(struct osmocom_ms *ms, struct msgb *msg);
@@ -400,7 +398,7 @@ static int subscr_sim_plmnsel(struct osmocom_ms *ms, uint8_t *data,
break;
/* add to list */
- plmn = talloc_zero(l23_ctx, struct gsm_sub_plmn_list);
+ plmn = talloc_zero(ms, struct gsm_sub_plmn_list);
if (!plmn)
return -ENOMEM;
lai[0] = data[0];
@@ -504,7 +502,7 @@ static int subscr_sim_fplmn(struct osmocom_ms *ms, uint8_t *data,
break;
/* add to list */
- na = talloc_zero(l23_ctx, struct gsm_sub_plmn_na);
+ na = talloc_zero(ms, struct gsm_sub_plmn_na);
if (!na)
return -ENOMEM;
lai[0] = data[0];
@@ -1119,7 +1117,7 @@ int gsm_subscr_add_forbidden_plmn(struct gsm_subscriber *subscr, uint16_t mcc,
LOGP(DPLMN, LOGL_INFO, "Add to list of forbidden PLMNs "
"(mcc=%s, mnc=%s)\n", gsm_print_mcc(mcc), gsm_print_mnc(mnc));
- na = talloc_zero(l23_ctx, struct gsm_sub_plmn_na);
+ na = talloc_zero(subscr->ms, struct gsm_sub_plmn_na);
if (!na)
return -ENOMEM;
na->mcc = mcc;