mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-msc.git
synced 2025-11-06 15:03:16 +00:00
gsm48_cc_tx_setup: move msgb_alloc down
Don't alloc msgb before it gets used. Change-Id: I99edbdc915552a4ab28ef6f7a1e55818092a2e20
This commit is contained in:
@@ -838,14 +838,12 @@ static void rx_mncc_sdp(struct gsm_trans *trans, uint32_t mncc_msg_type, const c
|
|||||||
|
|
||||||
static int gsm48_cc_tx_setup(struct gsm_trans *trans, void *arg)
|
static int gsm48_cc_tx_setup(struct gsm_trans *trans, void *arg)
|
||||||
{
|
{
|
||||||
struct msgb *msg = gsm48_msgb_alloc_name("GSM 04.08 CC SETUP");
|
struct msgb *msg;
|
||||||
struct gsm48_hdr *gh;
|
struct gsm48_hdr *gh;
|
||||||
struct gsm_mncc *setup = arg;
|
struct gsm_mncc *setup = arg;
|
||||||
int rc, trans_id;
|
int rc, trans_id;
|
||||||
struct gsm_mncc_bearer_cap bearer_cap;
|
struct gsm_mncc_bearer_cap bearer_cap;
|
||||||
|
|
||||||
gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh));
|
|
||||||
|
|
||||||
/* transaction id must not be assigned */
|
/* transaction id must not be assigned */
|
||||||
if (trans->transaction_id != TRANS_ID_UNASSIGNED) {
|
if (trans->transaction_id != TRANS_ID_UNASSIGNED) {
|
||||||
LOG_TRANS(trans, LOGL_DEBUG, "TX Setup with assigned transaction. "
|
LOG_TRANS(trans, LOGL_DEBUG, "TX Setup with assigned transaction. "
|
||||||
@@ -870,8 +868,6 @@ static int gsm48_cc_tx_setup(struct gsm_trans *trans, void *arg)
|
|||||||
}
|
}
|
||||||
trans->transaction_id = trans_id;
|
trans->transaction_id = trans_id;
|
||||||
|
|
||||||
gh->msg_type = GSM48_MT_CC_SETUP;
|
|
||||||
|
|
||||||
gsm48_start_cc_timer(trans, 0x303, GSM48_T303);
|
gsm48_start_cc_timer(trans, 0x303, GSM48_T303);
|
||||||
|
|
||||||
/* MT call leg is starting. Gather all codecs information so far known.
|
/* MT call leg is starting. Gather all codecs information so far known.
|
||||||
@@ -974,6 +970,10 @@ static int gsm48_cc_tx_setup(struct gsm_trans *trans, void *arg)
|
|||||||
/* Create a copy of the bearer capability in the transaction struct, so we can use this information later */
|
/* Create a copy of the bearer capability in the transaction struct, so we can use this information later */
|
||||||
trans->bearer_cap = bearer_cap;
|
trans->bearer_cap = bearer_cap;
|
||||||
|
|
||||||
|
msg = gsm48_msgb_alloc_name("GSM 04.08 CC SETUP");
|
||||||
|
gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh));
|
||||||
|
gh->msg_type = GSM48_MT_CC_SETUP;
|
||||||
|
|
||||||
gsm48_encode_bearer_cap(msg, 0, &bearer_cap);
|
gsm48_encode_bearer_cap(msg, 0, &bearer_cap);
|
||||||
|
|
||||||
/* facility */
|
/* facility */
|
||||||
@@ -1011,7 +1011,6 @@ static int gsm48_cc_tx_setup(struct gsm_trans *trans, void *arg)
|
|||||||
return trans_tx_gsm48(trans, msg);
|
return trans_tx_gsm48(trans, msg);
|
||||||
error:
|
error:
|
||||||
trans_free(trans);
|
trans_free(trans);
|
||||||
msgb_free(msg);
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user