From 7a44e47ed6d9e28a2f1e88b7a299ab29a9f9581b Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sat, 14 Jan 2012 12:28:17 +0100 Subject: OML SET CHAN ATTR: merge TS attributes (not BTS) and fix mem leak We have to * merge the new attributes with the exiting TS (not BTS) attributes * in case of success, attach the new merged attributes to our state * in case of success, free the old attributes Thanks to Holger for pointing this out. --- src/common/oml.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/common/oml.c') diff --git a/src/common/oml.c b/src/common/oml.c index 19e3038b..9c28e041 100644 --- a/src/common/oml.c +++ b/src/common/oml.c @@ -609,7 +609,7 @@ static int oml_rx_set_chan_attr(struct gsm_bts_trx_ts *ts, struct msgb *msg) } /* merge existing BTS attributes with new attributes */ - tp_merged = tlvp_copy(bts->mo.nm_attr, bts); + tp_merged = tlvp_copy(ts->mo.nm_attr, ts); tlvp_merge(tp_merged, &tp); /* Call into BTS driver to check attribute values */ @@ -620,6 +620,10 @@ static int oml_rx_set_chan_attr(struct gsm_bts_trx_ts *ts, struct msgb *msg) return rc; } + /* Success: replace old BTS attributes with new */ + talloc_free(ts->mo.nm_attr); + ts->mo.nm_attr = tp_merged; + /* 9.4.13 Channel Combination */ if (TLVP_PRESENT(&tp, NM_ATT_CHAN_COMB)) { uint8_t comb = *TLVP_VAL(&tp, NM_ATT_CHAN_COMB); -- cgit v1.2.3