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.
This commit is contained in:
Harald Welte 2012-01-14 12:28:17 +01:00
parent 6aa2a574fb
commit 7a44e47ed6
1 changed files with 5 additions and 1 deletions

View File

@ -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);