[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....
diff --git a/src/paging.c b/src/paging.c
index 0e5e457..ed40c07 100644
--- a/src/paging.c
+++ b/src/paging.c
@@ -203,6 +203,11 @@
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 @@
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 */