diff options
author | Harald Welte <laforge@gnumonks.org> | 2012-01-14 12:28:17 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2012-01-14 12:28:17 +0100 |
commit | 7a44e47ed6d9e28a2f1e88b7a299ab29a9f9581b (patch) | |
tree | 60c6c502c82672857a632f038d62f16a22eaabfb | |
parent | 6aa2a574fb63093b155b15e81cf31dd4b9304891 (diff) |
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.
-rw-r--r-- | src/common/oml.c | 6 |
1 files changed, 5 insertions, 1 deletions
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); |