mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-13 18:55:10 +01:00
Merge pull request #1991 from hitstergtd/x-testcov-zmq-2
Problem: zmq_poller_destroy can segfault
This commit is contained in:
commit
bd66cfe6f8
@ -1110,8 +1110,9 @@ void *zmq_poller_new (void)
|
||||
|
||||
int zmq_poller_destroy (void **poller_p_)
|
||||
{
|
||||
void *poller = *poller_p_;
|
||||
if (!poller || !((zmq::socket_poller_t*) poller)->check_tag ()) {
|
||||
void *poller;
|
||||
if (!poller_p_ || !(poller = *poller_p_) ||
|
||||
!((zmq::socket_poller_t*) poller)->check_tag ()) {
|
||||
errno = EFAULT;
|
||||
return -1;
|
||||
}
|
||||
|
@ -156,7 +156,15 @@ int main (void)
|
||||
rc = zmq_close (client);
|
||||
assert (rc == 0);
|
||||
#endif
|
||||
rc = zmq_poller_destroy(&poller);
|
||||
|
||||
// Test error - null poller pointers
|
||||
rc = zmq_poller_destroy (NULL);
|
||||
assert (rc == -1 && errno == EFAULT);
|
||||
void *null_poller = NULL;
|
||||
rc = zmq_poller_destroy (&null_poller);
|
||||
assert (rc == -1 && errno == EFAULT);
|
||||
|
||||
rc = zmq_poller_destroy (&poller);
|
||||
assert(rc == 0);
|
||||
rc = zmq_ctx_term (ctx);
|
||||
assert (rc == 0);
|
||||
|
Loading…
Reference in New Issue
Block a user