From 29d58b734d169021bb794d259fa0dde205545bf1 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Wed, 12 Aug 2015 13:35:46 +0200 Subject: [PATCH] sms: Attempt to plug memory leaks seen at Rhizomatica Using the talloc leak report we see that there are some msgb's that are allocated for SMS but we don't have transactions or SMS around. We need to improve the name of the messages to uniquely dscribe where they are from but the obvious leak does occur in this routine. The no available transaction id is most likely the case where we leak memory. This should not occur and shows another issue with the smsqueue/smpp handling. It doesn't explain the subscr reference count issue either. Extract of the leak report: GSM 04.11 contains 1160 bytes in 1 blocks (ref 0) 0x2517dc0 GSM 04.11 contains 1160 bytes in 1 blocks (ref 0) 0x24b56e0 GSM 04.11 contains 1160 bytes in 1 blocks (ref 0) 0x23e7930 --- openbsc/src/libmsc/gsm_04_11.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openbsc/src/libmsc/gsm_04_11.c b/openbsc/src/libmsc/gsm_04_11.c index c2cec26cd..266cd4dc0 100644 --- a/openbsc/src/libmsc/gsm_04_11.c +++ b/openbsc/src/libmsc/gsm_04_11.c @@ -869,6 +869,7 @@ int gsm411_send_sms(struct gsm_subscriber_connection *conn, struct gsm_sms *sms) LOGP(DLSMS, LOGL_ERROR, "No available transaction ids\n"); send_signal(S_SMS_UNKNOWN_ERROR, NULL, sms, 0); sms_free(sms); + msgb_free(msg); return -EBUSY; } @@ -882,6 +883,7 @@ int gsm411_send_sms(struct gsm_subscriber_connection *conn, struct gsm_sms *sms) LOGP(DLSMS, LOGL_ERROR, "No memory for trans\n"); send_signal(S_SMS_UNKNOWN_ERROR, NULL, sms, 0); sms_free(sms); + msgb_free(msg); /* FIXME: send some error message */ return -ENOMEM; }