PROTON-1766: [c] Fix missing NULL check in epoll proactor
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/103cdd5b Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/103cdd5b Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/103cdd5b Branch: refs/heads/master Commit: 103cdd5b1824c9f1e4a577256965af179b8a8030 Parents: 0666719 Author: Alan Conway <[email protected]> Authored: Wed Feb 21 15:05:40 2018 -0500 Committer: Alan Conway <[email protected]> Committed: Wed Feb 21 17:01:58 2018 -0500 ---------------------------------------------------------------------- proton-c/src/proactor/epoll.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/103cdd5b/proton-c/src/proactor/epoll.c ---------------------------------------------------------------------- diff --git a/proton-c/src/proactor/epoll.c b/proton-c/src/proactor/epoll.c index d9090f0..5f8c495 100644 --- a/proton-c/src/proactor/epoll.c +++ b/proton-c/src/proactor/epoll.c @@ -545,13 +545,13 @@ static pconnection_t *get_pconnection(pn_connection_t* c) { lock(&driver_ptr_mutex); pn_connection_driver_t *d = *pn_connection_driver_ptr(c); unlock(&driver_ptr_mutex); - pconnection_t *pc = (pconnection_t*)((char*)d-offsetof(pconnection_t, driver)); - return pc; + if (!d) return NULL; + return (pconnection_t*)((char*)d-offsetof(pconnection_t, driver)); } static void set_pconnection(pn_connection_t* c, pconnection_t *pc) { lock(&driver_ptr_mutex); - *pn_connection_driver_ptr(c) = &pc->driver; + *pn_connection_driver_ptr(c) = pc ? &pc->driver : NULL; unlock(&driver_ptr_mutex); } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
