summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/sccp_scrc.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/sccp_scrc.c b/src/sccp_scrc.c
index cd01774..9005dc7 100644
--- a/src/sccp_scrc.c
+++ b/src/sccp_scrc.c
@@ -438,13 +438,14 @@ int sccp_scrc_rx_sclc_msg(struct osmo_sccp_instance *inst,
}
/* Figure C.1/Q.714 Sheet 1 of 12, after we converted the
- * MTP-TRANSFER.ind to SUA */
+ * MTP-TRANSFER.ind to SUA. Takes ownership of \a xua and frees it once processed. */
int scrc_rx_mtp_xfer_ind_xua(struct osmo_sccp_instance *inst,
struct xua_msg *xua)
{
struct osmo_sccp_addr called;
uint32_t proto_class;
struct xua_msg_part *hop_ctr_part;
+ int rc;
LOGP(DLSS7, LOGL_DEBUG, "%s: %s\n", __func__, xua_msg_dump(xua, &xua_dialect_sua));
/* TODO: SCCP or nodal congestion? */
@@ -454,6 +455,7 @@ int scrc_rx_mtp_xfer_ind_xua(struct osmo_sccp_instance *inst,
/* Node 1 (Sheet 3) */
/* deliver to SCOC */
sccp_scoc_rx_from_scrc(inst, xua);
+ xua_msg_free(xua);
return 0;
}
/* We only treat connectionless and CR below */
@@ -463,7 +465,9 @@ int scrc_rx_mtp_xfer_ind_xua(struct osmo_sccp_instance *inst,
/* Route on GT? */
if (called.ri != OSMO_SCCP_RI_GT) {
/* Node 6 (Sheet 3) */
- return scrc_node_6(inst, xua, &called);
+ rc = scrc_node_6(inst, xua, &called);
+ xua_msg_free(xua);
+ return rc;
}
/* Message with hop-counter? */
hop_ctr_part = xua_msg_find_tag(xua, SUA_IEI_S7_HOP_CTR);
@@ -472,7 +476,9 @@ int scrc_rx_mtp_xfer_ind_xua(struct osmo_sccp_instance *inst,
if (hop_counter <= 1) {
/* Error: hop-counter violation */
/* node 4 */
- return scrc_node_4(inst, xua, SCCP_RETURN_CAUSE_HOP_COUNTER_VIOLATION);
+ rc = scrc_node_4(inst, xua, SCCP_RETURN_CAUSE_HOP_COUNTER_VIOLATION);
+ xua_msg_free(xua);
+ return rc;
}
/* Decrement hop-counter */
hop_counter--;
@@ -492,5 +498,7 @@ int scrc_rx_mtp_xfer_ind_xua(struct osmo_sccp_instance *inst,
default:
break;
}
- return scrc_translate_node_9(inst, xua, &called);
+ rc = scrc_translate_node_9(inst, xua, &called);
+ xua_msg_free(xua);
+ return rc;
}