[PATCH] LAPD: Free resume/re-establishment msgb if it carries no content

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Andreas Eversberg jolly at eversberg.eu
Tue Jul 9 18:25:24 UTC 2013


lapdm.c takes the re-establishment message and forwards it to lapd_core.c,
so we can assume that msgb is set at primitive. In case there is data in
the re-establishment msg, it is moved into send_buffer. In case of no
data (0 length), it must be freed.
---
 src/gsm/lapd_core.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gsm/lapd_core.c b/src/gsm/lapd_core.c
index 68b5e78..08143ed 100644
--- a/src/gsm/lapd_core.c
+++ b/src/gsm/lapd_core.c
@@ -1962,11 +1962,13 @@ static int lapd_res_req(struct osmo_dlsap_prim *dp, struct lapd_msg_ctx *lctx)
 	if (dl->send_buffer)
 		msgb_free(dl->send_buffer);
 	dl->send_out = 0;
-	if (msg && msg->len)
+	if (msg->len) {
 		/* Write data into the send buffer, to be sent first */
 		dl->send_buffer = msg;
-	else
+	} else {
+		msgb_free(msg);
 		dl->send_buffer = NULL;
+	}
 
 	/* Discard partly received L3 message */
 	if (dl->rcv_buffer) {
-- 
1.7.3.4


--------------030109030604040502010001--




More information about the OpenBSC mailing list