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.
diff --git a/openbsc/src/libmsc/smpp_smsc.c b/openbsc/src/libmsc/smpp_smsc.c
index f9e517b..aaf8521 100644
--- a/openbsc/src/libmsc/smpp_smsc.c
+++ b/openbsc/src/libmsc/smpp_smsc.c
@@ -40,6 +40,7 @@
#include "smpp_smsc.h"
#include <openbsc/debug.h>
+#include <openbsc/gsm_data.h>
/*! \brief Ugly wrapper. libsmpp34 should do this itself! */
#define SMPP34_UNPACK(rc, type, str, data, len) \
@@ -718,7 +719,7 @@
}
/*! \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 @@
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;