aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/src/abis_rsl.c14
-rw-r--r--openbsc/src/e1_input.c1
2 files changed, 11 insertions, 4 deletions
diff --git a/openbsc/src/abis_rsl.c b/openbsc/src/abis_rsl.c
index 397d793c7..c2ef9e5cf 100644
--- a/openbsc/src/abis_rsl.c
+++ b/openbsc/src/abis_rsl.c
@@ -360,13 +360,15 @@ int rsl_sacch_filling(struct gsm_bts_trx *trx, u_int8_t type,
int rsl_chan_bs_power_ctrl(struct gsm_lchan *lchan, unsigned int fpc, int db)
{
struct abis_rsl_dchan_hdr *dh;
- struct msgb *msg = rsl_msgb_alloc();
+ struct msgb *msg;
u_int8_t chan_nr = lchan2chan_nr(lchan);
db = abs(db);
if (db > 30)
return -EINVAL;
+ msg = rsl_msgb_alloc();
+
lchan->bs_power = db/2;
if (fpc)
lchan->bs_power |= 0x10;
@@ -457,7 +459,7 @@ static int ms_pwr_dbm(enum gsm_band band, u_int8_t lvl)
int rsl_chan_ms_power_ctrl(struct gsm_lchan *lchan, unsigned int fpc, int dbm)
{
struct abis_rsl_dchan_hdr *dh;
- struct msgb *msg = rsl_msgb_alloc();
+ struct msgb *msg;
u_int8_t chan_nr = lchan2chan_nr(lchan);
int ctl_lvl;
@@ -465,6 +467,8 @@ int rsl_chan_ms_power_ctrl(struct gsm_lchan *lchan, unsigned int fpc, int dbm)
if (ctl_lvl < 0)
return ctl_lvl;
+ msg = rsl_msgb_alloc();
+
lchan->ms_power = ctl_lvl;
if (fpc)
@@ -521,7 +525,7 @@ int rsl_chan_activate_lchan(struct gsm_lchan *lchan, u_int8_t act_type,
u_int8_t ta, u_int8_t mode)
{
struct abis_rsl_dchan_hdr *dh;
- struct msgb *msg = rsl_msgb_alloc();
+ struct msgb *msg;
u_int8_t chan_nr = lchan2chan_nr(lchan);
u_int16_t arfcn = lchan->ts->trx->arfcn;
@@ -564,6 +568,7 @@ int rsl_chan_activate_lchan(struct gsm_lchan *lchan, u_int8_t act_type,
ci.chan_desc.oct3 = (lchan->ts->trx->bts->tsc << 5) | ((arfcn & 0x3ff) >> 8);
ci.chan_desc.oct4 = arfcn & 0xff;
+ msg = rsl_msgb_alloc();
dh = (struct abis_rsl_dchan_hdr *) msgb_put(msg, sizeof(*dh));
init_dchan_hdr(dh, RSL_MT_CHAN_ACTIV);
dh->chan_nr = chan_nr;
@@ -591,7 +596,7 @@ int rsl_chan_activate_lchan(struct gsm_lchan *lchan, u_int8_t act_type,
int rsl_chan_mode_modify_req(struct gsm_lchan *lchan)
{
struct abis_rsl_dchan_hdr *dh;
- struct msgb *msg = rsl_msgb_alloc();
+ struct msgb *msg;
u_int8_t chan_nr = lchan2chan_nr(lchan);
struct rsl_ie_chan_mode cm;
@@ -622,6 +627,7 @@ int rsl_chan_mode_modify_req(struct gsm_lchan *lchan)
return -1;
}
+ msg = rsl_msgb_alloc();
dh = (struct abis_rsl_dchan_hdr *) msgb_put(msg, sizeof(*dh));
init_dchan_hdr(dh, RSL_MT_MODE_MODIFY_REQ);
dh->chan_nr = chan_nr;
diff --git a/openbsc/src/e1_input.c b/openbsc/src/e1_input.c
index 56bce019c..2d0c1340f 100644
--- a/openbsc/src/e1_input.c
+++ b/openbsc/src/e1_input.c
@@ -236,6 +236,7 @@ int abis_rsl_sendmsg(struct msgb *msg)
if (!msg->trx || !msg->trx->rsl_link) {
fprintf(stderr, "rsl_sendmsg: msg->trx == NULL\n");
+ talloc_free(msg);
return -EINVAL;
}