aboutsummaryrefslogtreecommitdiffstats
path: root/src/paging.c
diff options
context:
space:
mode:
authorHolger Freyther <zecke@selfish.org>2009-02-14 23:53:20 +0000
committerHolger Freyther <zecke@selfish.org>2009-02-14 23:53:20 +0000
commit49314f60802dac6950479fc5ee6cdb190a943d41 (patch)
tree2baa12e9de75c8b37d8df9041f03c3a1acdfdd4e /src/paging.c
parent2fa4cb5bc9828be804662487d179488663aa4abe (diff)
[paging] Do not create a request when one is already pending...
This is removing a memleak, saving some mallocs and a crash in the timer expired function that attempted to remove the paging_request from a list it was not in....
Diffstat (limited to 'src/paging.c')
-rw-r--r--src/paging.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/paging.c b/src/paging.c
index 0e5e45727..ed40c0794 100644
--- a/src/paging.c
+++ b/src/paging.c
@@ -203,6 +203,11 @@ void paging_request(struct gsm_bts *bts, struct gsm_subscriber *subscr, int type
struct gsm_bts_paging_state *bts_entry = &bts->paging;
struct gsm_paging_request *req;
+ if (paging_pending_request(bts_entry, subscr)) {
+ DEBUGP(DPAG, "Paging request already pending\n");
+ return;
+ }
+
req = (struct gsm_paging_request *)malloc(sizeof(*req));
memset(req, 0, sizeof(*req));
req->subscr = subscr_get(subscr);
@@ -211,12 +216,7 @@ void paging_request(struct gsm_bts *bts, struct gsm_subscriber *subscr, int type
req->T3113.cb = paging_T3113_expired;
req->T3113.data = req;
schedule_timer(&req->T3113, T3113_VALUE);
-
- if (!paging_pending_request(bts_entry, subscr)) {
- llist_add_tail(&req->entry, &bts_entry->pending_requests);
- } else {
- DEBUGP(DPAG, "Paging request already pending\n");
- }
+ llist_add_tail(&req->entry, &bts_entry->pending_requests);
}
/* we consciously ignore the type of the request here */