mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-10 07:56:09 +00:00
memory leak in REQ socket fixed
This commit is contained in:
parent
3bb60da0d0
commit
2e9be56a40
34
src/req.cpp
34
src/req.cpp
@ -70,21 +70,8 @@ void zmq::req_t::xdetach_inpipe (class reader_t *pipe_)
|
|||||||
|
|
||||||
in_pipes_t::size_type index = in_pipes.index (pipe_);
|
in_pipes_t::size_type index = in_pipes.index (pipe_);
|
||||||
|
|
||||||
// If the corresponding outpipe is still in place nullify the pointer
|
if (out_pipes [index])
|
||||||
// to the inpipe ane move both pipes into inactive zone.
|
out_pipes [index]->term ();
|
||||||
if (out_pipes [index]) {
|
|
||||||
in_pipes [index] = NULL;
|
|
||||||
if (index < active) {
|
|
||||||
active--;
|
|
||||||
in_pipes.swap (index, active);
|
|
||||||
out_pipes.swap (index, active);
|
|
||||||
if (current == active)
|
|
||||||
current = 0;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now both inpipe and outpipe are detached. Remove them from the lists.
|
|
||||||
in_pipes.erase (index);
|
in_pipes.erase (index);
|
||||||
out_pipes.erase (index);
|
out_pipes.erase (index);
|
||||||
if (index < active) {
|
if (index < active) {
|
||||||
@ -103,21 +90,8 @@ void zmq::req_t::xdetach_outpipe (class writer_t *pipe_)
|
|||||||
|
|
||||||
out_pipes_t::size_type index = out_pipes.index (pipe_);
|
out_pipes_t::size_type index = out_pipes.index (pipe_);
|
||||||
|
|
||||||
// If the corresponding inpipe is still in place nullify the pointer
|
if (in_pipes [index])
|
||||||
// to the outpipe and move both pipes into inactive zone.
|
in_pipes [index]->term ();
|
||||||
if (in_pipes [index]) {
|
|
||||||
out_pipes [index] = NULL;
|
|
||||||
if (index < active) {
|
|
||||||
active--;
|
|
||||||
in_pipes.swap (index, active);
|
|
||||||
out_pipes.swap (index, active);
|
|
||||||
if (current == active)
|
|
||||||
current = 0;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now both inpipe and outpipe are detached. Remove them from the lists.
|
|
||||||
in_pipes.erase (index);
|
in_pipes.erase (index);
|
||||||
out_pipes.erase (index);
|
out_pipes.erase (index);
|
||||||
if (index < active) {
|
if (index < active) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user