[PATCH] libosmocore[master]: Fix LAPD UA message buffer memory leak.

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/gerrit-log@lists.osmocom.org/.

jfdionne gerrit-no-reply at lists.osmocom.org
Wed Mar 8 18:56:34 UTC 2017


Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/1984

to look at the new patch set (#2).

Fix LAPD UA message buffer memory leak.

The state check in lapd_dl_reset causes some buffers
never to be released. Using talloc report LAPD UA
message buffers are never released after each call
and cause a memory leak.

Change-Id: I2799b70623f2ec4dbc725eb213e332e98da02a3e
---
M src/gsm/lapd_core.c
1 file changed, 5 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/84/1984/2

diff --git a/src/gsm/lapd_core.c b/src/gsm/lapd_core.c
index 5ee88a4..256401c 100644
--- a/src/gsm/lapd_core.c
+++ b/src/gsm/lapd_core.c
@@ -303,11 +303,6 @@
 /* reset to IDLE state */
 void lapd_dl_reset(struct lapd_datalink *dl)
 {
-	if (dl->state == LAPD_STATE_IDLE)
-		return;
-	LOGP(DLLAPD, LOGL_INFO, "Resetting LAPDm instance (dl=%p)\n", dl);
-	/* enter idle state (and remove eventual cont_res) */
-	lapd_dl_newstate(dl, LAPD_STATE_IDLE);
 	/* flush buffer */
 	lapd_dl_flush_tx(dl);
 	lapd_dl_flush_send(dl);
@@ -317,6 +312,11 @@
 	/* stop Timers */
 	lapd_stop_t200(dl);
 	lapd_stop_t203(dl);
+	if (dl->state == LAPD_STATE_IDLE)
+		return;
+	LOGP(DLLAPD, LOGL_INFO, "Resetting LAPDm instance (dl=%p)\n", dl);
+	/* enter idle state (and remove eventual cont_res) */
+	lapd_dl_newstate(dl, LAPD_STATE_IDLE);
 }
 
 /* reset and de-allocate history buffer */

-- 
To view, visit https://gerrit.osmocom.org/1984
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I2799b70623f2ec4dbc725eb213e332e98da02a3e
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: jfdionne <jf.dionne at nutaq.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list