aboutsummaryrefslogtreecommitdiffstats
path: root/src/sctp_m2ua.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-02-15 16:51:43 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-02-17 19:34:27 +0100
commit1927e638e18ff03a77a9e227c12f7050559a93c5 (patch)
treeee2ea6888ff218b2fec98219caf245848650c320 /src/sctp_m2ua.c
parentb187049925311041fb9d6bacd8960d02759c473c (diff)
m2ua: Close a huge memory leak in the m2ua code.
Diffstat (limited to 'src/sctp_m2ua.c')
-rw-r--r--src/sctp_m2ua.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/sctp_m2ua.c b/src/sctp_m2ua.c
index 83784ec..2bafdab 100644
--- a/src/sctp_m2ua.c
+++ b/src/sctp_m2ua.c
@@ -454,7 +454,7 @@ static int sctp_m2ua_write(struct mtp_link *link, struct msgb *msg)
trans = (struct mtp_m2ua_link *) link;
if (llist_empty(&trans->conns))
- return -1;
+ goto clean;
llist_for_each_entry(tmp, &trans->conns, entry)
if (tmp->established && tmp->asp_active && tmp->asp_up) {
@@ -464,12 +464,12 @@ static int sctp_m2ua_write(struct mtp_link *link, struct msgb *msg)
if (!conn) {
LOGP(DINP, LOGL_ERROR, "No active ASP?\n");
- return -1;
+ goto clean;
}
m2ua = m2ua_msg_alloc();
if (!m2ua)
- return -1;
+ goto clean;
mtp_handle_pcap(link, NET_OUT, msg->data, msg->len);
@@ -487,6 +487,9 @@ static int sctp_m2ua_write(struct mtp_link *link, struct msgb *msg)
m2ua_conn_send(conn, m2ua, &info);
m2ua_msg_free(m2ua);
+
+clean:
+ msgb_free(msg);
return 0;
}