aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2021-08-23 14:19:21 +0200
committerOliver Smith <osmith@sysmocom.de>2021-08-23 14:51:18 +0200
commit3f79470453f7bede9ab7335d2b0fefcb2ac426c8 (patch)
treee339a20aea17d9b24919d92d0edcf14df4b76544 /src
parent3bd648888910d8135e78c02b2f123163ac0ff2a3 (diff)
bts: delete pch_timer list in destructor
Run bts_pch_timer_remove() on each entry of the BTS specific pch_timer list, so we don't have a memory leak and so the timer doesn't potentially fire for a deallocated BTS. Fixes: d3c7591 ("Add counters: pcu.bts.N.pch.requests.timeout") Change-Id: Ia5e33d1894408e93a51c452002ef2f5758808269
Diffstat (limited to 'src')
-rw-r--r--src/bts.cpp3
-rw-r--r--src/bts_pch_timer.c9
-rw-r--r--src/bts_pch_timer.h1
3 files changed, 13 insertions, 0 deletions
diff --git a/src/bts.cpp b/src/bts.cpp
index a40e071d..daa8ee1d 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -32,6 +32,7 @@
#include <pdch.h>
#include <gprs_ms_storage.h>
#include <sba.h>
+#include <bts_pch_timer.h>
extern "C" {
#include <osmocom/core/talloc.h>
@@ -230,6 +231,8 @@ static int bts_talloc_destructor(struct gprs_rlcmac_bts* bts)
bts->app_info = NULL;
}
+ bts_pch_timer_stop_all(bts);
+
llist_del(&bts->list);
return 0;
}
diff --git a/src/bts_pch_timer.c b/src/bts_pch_timer.c
index 386a583c..20373ac8 100644
--- a/src/bts_pch_timer.c
+++ b/src/bts_pch_timer.c
@@ -83,3 +83,12 @@ void bts_pch_timer_stop(struct gprs_rlcmac_bts *bts, const char *imsi)
if (p)
bts_pch_timer_remove(p);
}
+
+void bts_pch_timer_stop_all(struct gprs_rlcmac_bts *bts)
+{
+ struct bts_pch_timer *p, *n;
+
+ llist_for_each_entry_safe(p, n, &bts->pch_timer, entry) {
+ bts_pch_timer_remove(p);
+ }
+}
diff --git a/src/bts_pch_timer.h b/src/bts_pch_timer.h
index 91bebedb..26b89c80 100644
--- a/src/bts_pch_timer.h
+++ b/src/bts_pch_timer.h
@@ -37,6 +37,7 @@ struct bts_pch_timer {
void bts_pch_timer_start(struct gprs_rlcmac_bts *bts, const char *imsi);
void bts_pch_timer_stop(struct gprs_rlcmac_bts *bts, const char *imsi);
+void bts_pch_timer_stop_all(struct gprs_rlcmac_bts *bts);
#ifdef __cplusplus
}