diff options
| author | Martin Sustrik <sustrik@250bpm.com> | 2010-05-31 06:17:58 +0200 | 
|---|---|---|
| committer | Martin Sustrik <sustrik@250bpm.com> | 2010-05-31 06:17:58 +0200 | 
| commit | 2e9be56a4059cf230f6aa92eb1c71db5f1200b8e (patch) | |
| tree | ebf63682ff2b2d63d75f0516fb746a7c0136cbfb | |
| parent | 3bb60da0d085b1089ddec4617fcd40f2cda88567 (diff) | |
memory leak in REQ socket fixed
| -rw-r--r-- | src/req.cpp | 34 | 
1 files changed, 4 insertions, 30 deletions
| diff --git a/src/req.cpp b/src/req.cpp index 969755b..9db7b60 100644 --- a/src/req.cpp +++ b/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_); -    //  If the corresponding outpipe is still in place nullify the pointer -    //  to the inpipe ane move both pipes into inactive zone. -    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. +    if (out_pipes [index]) +        out_pipes [index]->term ();      in_pipes.erase (index);      out_pipes.erase (index);      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_); -    //  If the corresponding inpipe is still in place nullify the pointer -    //  to the outpipe and move both pipes into inactive zone. -    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. +    if (in_pipes [index]) +        in_pipes [index]->term ();      in_pipes.erase (index);      out_pipes.erase (index);      if (index < active) { | 
