mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-13 10:52:56 +01:00
Problem: test_udp does not release resources properly
Solution: - call zmq_msg_close() if there is an error - call free() to release resources if there is an error (CWE-404)
This commit is contained in:
parent
c354e0b371
commit
9a9bfb6443
@ -57,8 +57,10 @@ int msg_recv_cmp (zmq_msg_t *msg_, void *s_, const char* group_, const char* bod
|
||||
return -1;
|
||||
|
||||
int recv_rc = zmq_msg_recv (msg_, s_, 0);
|
||||
if (recv_rc == -1)
|
||||
if (recv_rc == -1) {
|
||||
zmq_msg_close(msg_);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (strcmp (zmq_msg_group (msg_), group_) != 0)
|
||||
{
|
||||
@ -73,6 +75,7 @@ int msg_recv_cmp (zmq_msg_t *msg_, void *s_, const char* group_, const char* bod
|
||||
if (strcmp (body, body_) != 0)
|
||||
{
|
||||
zmq_msg_close (msg_);
|
||||
free(body);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user