summaryrefslogtreecommitdiff
path: root/msm8998
diff options
context:
space:
mode:
authorNiranjan Pendharkar <npendhar@codeaurora.org>2017-06-28 13:26:53 -0700
committerpkanwar <pkanwar@google.com>2017-06-28 13:58:41 -0700
commit17ec1600b8e95cfdd4df25296bc362dd98cf74dd (patch)
treef468d15aa99f43868ff1f126ab5d719dc2d63853 /msm8998
parent8959650f66f8006633a6eed763d8f27caf232799 (diff)
downloadipacfg-mgr-17ec1600b8e95cfdd4df25296bc362dd98cf74dd.tar.gz
ipacm: add NULL check on conntrack de-registration
Add NULL check when unregistering with conntrack to release filters and handles. CRs-fixed: 2068687 Bug: 34361337 Test: manual Change-Id: I8f48be78ebf6f0972d82d0da793f4ff898682aa8 Signed-off-by: Skylar Change <chiaweic@codeaurora.org> Signed-off-by: Niranjan Pendharkar <npendhar@codeaurora.org>
Diffstat (limited to 'msm8998')
-rw-r--r--msm8998/ipacm/src/IPACM_ConntrackClient.cpp43
1 files changed, 29 insertions, 14 deletions
diff --git a/msm8998/ipacm/src/IPACM_ConntrackClient.cpp b/msm8998/ipacm/src/IPACM_ConntrackClient.cpp
index 8cc3407..10154ea 100644
--- a/msm8998/ipacm/src/IPACM_ConntrackClient.cpp
+++ b/msm8998/ipacm/src/IPACM_ConntrackClient.cpp
@@ -598,28 +598,43 @@ void IPACM_ConntrackClient::UNRegisterWithConnTrack(void)
IPACMDBG("\n");
+ pClient = IPACM_ConntrackClient::GetInstance();
+ if(pClient == NULL)
+ {
+ IPACMERR("unable to retrieve instance of conntrack client\n");
+ return;
+ }
+
/* destroy the TCP filter.. this will not detach the filter */
- nfct_filter_destroy(pClient->tcp_filter);
- pClient->tcp_filter = NULL;
+ if (pClient->tcp_filter) {
+ nfct_filter_destroy(pClient->tcp_filter);
+ pClient->tcp_filter = NULL;
+ }
/* de-register the callback */
- nfct_callback_unregister(pClient->tcp_hdl);
- /* close the handle */
- nfct_close(pClient->tcp_hdl);
- pClient->tcp_hdl = NULL;
+ if (pClient->tcp_hdl) {
+ nfct_callback_unregister(pClient->tcp_hdl);
+ /* close the handle */
+ nfct_close(pClient->tcp_hdl);
+ pClient->tcp_hdl = NULL;
+ }
/* destroy the filter.. this will not detach the filter */
- nfct_filter_destroy(pClient->udp_filter);
- pClient->udp_filter = NULL;
+ if (pClient->udp_filter) {
+ nfct_filter_destroy(pClient->udp_filter);
+ pClient->udp_filter = NULL;
+ }
/* de-register the callback */
- nfct_callback_unregister(pClient->udp_hdl);
- /* close the handle */
- nfct_close(pClient->udp_hdl);
- pClient->udp_hdl = NULL;
+ if (pClient->udp_hdl) {
+ nfct_callback_unregister(pClient->udp_hdl);
+ /* close the handle */
+ nfct_close(pClient->udp_hdl);
+ pClient->udp_hdl = NULL;
+ }
- pClient->fd_tcp = 0;
- pClient->fd_udp = 0;
+ pClient->fd_tcp = -1;
+ pClient->fd_udp = -1;
return;
}