[PATCH] libosmo-netif[master]: osmux: Add function to delete all msgs pending for a circuit

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/.

daniel gerrit-no-reply at lists.osmocom.org
Wed May 25 16:52:00 UTC 2016


Review at  https://gerrit.osmocom.org/120

osmux: Add function to delete all msgs pending for a circuit

Use this function in osmux_batch_del_circuit() since msgs are stored in a list
per circuit. After the circuit is free()d the msgs are lost.
Before this patch any messages enqueued inside a batch when the circiut is
deleted were leaking.

Change-Id: Ib0311652183332d0475bf7347023d518d38487ef
Ticket: OS#1733
---
M src/osmux.c
1 file changed, 12 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/20/120/1

diff --git a/src/osmux.c b/src/osmux.c
index 44b4b96..01d0bdc 100644
--- a/src/osmux.c
+++ b/src/osmux.c
@@ -225,6 +225,17 @@
 	circuit->nmsgs--;
 }
 
+static void osmux_circuit_del_msgs(struct osmux_batch *batch, struct osmux_circuit *circuit)
+{
+	struct msgb *cur, *tmp;
+		llist_for_each_entry_safe(cur, tmp, &circuit->msg_list, list) {
+
+			osmux_batch_dequeue(cur, circuit);
+			msgb_free(cur);
+			batch->nmsgs--;
+		}
+}
+
 struct osmux_input_state {
 	struct msgb	*out_msg;
 	struct msgb	*msg;
@@ -538,6 +549,7 @@
 	if (circuit->dummy)
 		batch->ndummy--;
 	llist_del(&circuit->head);
+	osmux_circuit_del_msgs(batch, circuit);
 	talloc_free(circuit);
 }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib0311652183332d0475bf7347023d518d38487ef
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Owner: daniel <dwillmann at sysmocom.de>



More information about the OpenBSC mailing list