summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xril/libsecril-client/secril-client.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/ril/libsecril-client/secril-client.cpp b/ril/libsecril-client/secril-client.cpp
index d96f19b..a0bf078 100755
--- a/ril/libsecril-client/secril-client.cpp
+++ b/ril/libsecril-client/secril-client.cpp
@@ -1088,6 +1088,8 @@ static int SendOemRequestHookRaw(HRilClient client, int req_id, char *data, size
RilClientPrv *client_prv;
int maxfd = -1;
+ unsigned int check_req_id = req_id;
+
client_prv = (RilClientPrv *)(client->prv);
// Allocate a token.
@@ -1126,6 +1128,13 @@ static int SendOemRequestHookRaw(HRilClient client, int req_id, char *data, size
goto error;
}
+ // check if the handler for specified event is NULL and deregister token
+ // to prevent token pool overflow
+ if(!FindReqHandler(client_prv, token, &check_req_id)) {
+ FreeToken(&(client_prv->token_pool), token);
+ ClearReqHistory(client_prv, token);
+ }
+
return RIL_CLIENT_ERR_SUCCESS;
error: