diff options
author | Niranjan Pendharkar <npendhar@codeaurora.org> | 2017-06-29 15:36:04 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-06-29 15:36:04 +0000 |
commit | 6bad500db99d7f26b5745a4b328987d1574391ac (patch) | |
tree | f468d15aa99f43868ff1f126ab5d719dc2d63853 | |
parent | 98086c09546fe7208ebaffe44be838b17363e180 (diff) | |
parent | 17ec1600b8e95cfdd4df25296bc362dd98cf74dd (diff) | |
download | ipacfg-mgr-6bad500db99d7f26b5745a4b328987d1574391ac.tar.gz |
ipacm: add NULL check on conntrack de-registration
am: 17ec1600b8
Change-Id: I323a80fe3e419a072501ed3a9fed6092d68ba254
-rw-r--r-- | msm8998/ipacm/src/IPACM_ConntrackClient.cpp | 43 |
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; } |