summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2021-11-25 15:49:52 +0100
committerHarald Welte <laforge@osmocom.org>2021-11-25 15:49:52 +0100
commit20d20c8da11b5558d5368aef52a15a3bc0990d60 (patch)
tree9b0cc89a0f4f512ebb602a5c461a97c30c9d8ee4
parent20616fe31684f60a69e0f4ad0c0351d2064df563 (diff)
fix memory leaks when osmo_wqueue_enqueue() failsHEADmaster
Related: OS#5329
-rw-r--r--src/scXp.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/scXp.c b/src/scXp.c
index 0cc1ac4..c39daf7 100644
--- a/src/scXp.c
+++ b/src/scXp.c
@@ -48,7 +48,10 @@ int tcap_tco_n_notice_ind(struct tcap_transport_entity *se);
static int tcap_tp_udp_unitdata_req(struct tcap_transport_entity *se, struct msgb *msg)
{
- return osmo_wqueue_enqueue(&se->udp.write_queue, msg);
+ int rc = osmo_wqueue_enqueue(&se->udp.write_queue, msg);
+ if (rc < 0)
+ msgb_free(msg);
+ return rc;
}
/* called by the write queue / FD magic in case we need to write a message */
@@ -138,6 +141,8 @@ int tcap_scXp_n_unitdata_req(struct tcap_transport_entity *se, struct msgb *msg)
switch (se->type) {
case SCXP_T_UDP:
rc = osmo_wqueue_enqueue(&se->udp.write_queue, msg);
+ if (rc < 0)
+ msgb_free(msg);
break;
}