osmith has submitted this change. (
https://gerrit.osmocom.org/c/osmo-msc/+/41036?usp=email )
Change subject: gsm48_cc_tx_setup: add goto error
......................................................................
gsm48_cc_tx_setup: add goto error
Move common clean up code to a new error label.
Change-Id: Ic8268d32df968d2e7c80f62b4a4fe370052f999f
---
M src/libmsc/gsm_04_08_cc.c
1 file changed, 10 insertions(+), 18 deletions(-)
Approvals:
Jenkins Builder: Verified
pespin: Looks good to me, but someone else must approve
fixeria: Looks good to me, approved
diff --git a/src/libmsc/gsm_04_08_cc.c b/src/libmsc/gsm_04_08_cc.c
index 467305d..59f42c8 100644
--- a/src/libmsc/gsm_04_08_cc.c
+++ b/src/libmsc/gsm_04_08_cc.c
@@ -855,9 +855,7 @@
GSM48_CAUSE_LOC_PRN_S_LU,
GSM48_CC_CAUSE_RESOURCE_UNAVAIL);
trans->callref = 0;
- trans_free(trans);
- msgb_free(msg);
- return rc;
+ goto error;
}
/* Get free transaction_id */
@@ -868,9 +866,7 @@
GSM48_CAUSE_LOC_PRN_S_LU,
GSM48_CC_CAUSE_RESOURCE_UNAVAIL);
trans->callref = 0;
- trans_free(trans);
- msgb_free(msg);
- return rc;
+ goto error;
}
trans->transaction_id = trans_id;
@@ -929,9 +925,7 @@
rc = bearer_cap_set_radio(&bearer_cap);
if (rc) {
LOG_TRANS(trans, LOGL_ERROR, "Error composing Bearer Capability for CC
Setup\n");
- trans_free(trans);
- msgb_free(msg);
- return rc;
+ goto error;
}
/* If no resulting codecs remain, error out. We cannot find a codec that matches both
call legs. If the MGW were
* able to transcode, we could use non-identical codecs on each conn of the MGW
endpoint, but we are aiming for
@@ -946,16 +940,12 @@
GSM48_CAUSE_LOC_PRN_S_LU,
GSM48_CC_CAUSE_INCOMPAT_DEST /* TODO: correct cause code? */);
trans->callref = 0;
- trans_free(trans);
- msgb_free(msg);
- return rc;
+ goto error;
}
rc = bearer_cap_filter_rev_lev(&bearer_cap,
trans->vsub->classmark.classmark1.rev_lev);
if (rc) {
LOG_TRANS(trans, LOGL_ERROR, "No codec offered is supported by phase 1
mobile.\n");
- trans_free(trans);
- msgb_free(msg);
- return rc;
+ goto error;
}
break;
case GSM48_BCAP_ITCAP_3k1_AUDIO:
@@ -976,9 +966,7 @@
GSM48_CAUSE_LOC_PRN_S_LU,
GSM48_CC_CAUSE_INCOMPAT_DEST /* TODO: correct cause code? */);
trans->callref = 0;
- trans_free(trans);
- msgb_free(msg);
- return rc;
+ goto error;
}
break;
}
@@ -1021,6 +1009,10 @@
rate_ctr_inc(rate_ctr_group_get_ctr(trans->net->msc_ctrs,
MSC_CTR_CALL_MT_SETUP));
return trans_tx_gsm48(trans, msg);
+error:
+ trans_free(trans);
+ msgb_free(msg);
+ return rc;
}
static int gsm48_cc_rx_call_conf(struct gsm_trans *trans, struct msgb *msg)
--
To view, visit
https://gerrit.osmocom.org/c/osmo-msc/+/41036?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: Ic8268d32df968d2e7c80f62b4a4fe370052f999f
Gerrit-Change-Number: 41036
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>