From d7b22c624bb04e585de4f06a3a32b98f45f7e4b8 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 29 Apr 2013 09:11:02 +0200 Subject: smpp: Attempt to fix a memory leak of the msgb The smpp_pdu_rx method does not free the msgb. Introduce an annotation (currently defined to nothing) to indicate what will happen to a msgb. --- openbsc/src/libmsc/smpp_smsc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'openbsc/src/libmsc/smpp_smsc.c') diff --git a/openbsc/src/libmsc/smpp_smsc.c b/openbsc/src/libmsc/smpp_smsc.c index f9e517b2b..aaf85212a 100644 --- a/openbsc/src/libmsc/smpp_smsc.c +++ b/openbsc/src/libmsc/smpp_smsc.c @@ -40,6 +40,7 @@ #include "smpp_smsc.h" #include +#include /*! \brief Ugly wrapper. libsmpp34 should do this itself! */ #define SMPP34_UNPACK(rc, type, str, data, len) \ @@ -718,7 +719,7 @@ static int smpp_handle_submit(struct osmo_esme *esme, struct msgb *msg) } /*! \brief one complete SMPP PDU from the ESME has been received */ -static int smpp_pdu_rx(struct osmo_esme *esme, struct msgb *msg) +static int smpp_pdu_rx(struct osmo_esme *esme, struct msgb *msg __uses) { uint32_t cmd_id = smpp_msgb_cmdid(msg); int rc = 0; @@ -822,6 +823,7 @@ static int esme_link_read_cb(struct osmo_fd *ofd) if (esme->read_idx >= esme->read_len) { rc = smpp_pdu_rx(esme, esme->read_msg); + msgb_free(esme->read_msg); esme->read_msg = NULL; esme->read_idx = 0; esme->read_len = 0; -- cgit v1.2.3