Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
18791f2b
Commit
18791f2b
authored
Jul 22, 2015
by
Brian Silverman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix several missing msg_t::close calls.
I traced memory leaks found using AddressSanitizer down to these.
parent
3f70aca7
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
0 deletions
+18
-0
stream.cpp
src/stream.cpp
+2
-0
test_client_server.cpp
tests/test_client_server.cpp
+5
-0
test_srcfd.cpp
tests/test_srcfd.cpp
+3
-0
test_stream_disconnect.cpp
tests/test_stream_disconnect.cpp
+8
-0
No files found.
src/stream.cpp
View file @
18791f2b
...
@@ -229,6 +229,8 @@ int zmq::stream_t::xrecv (msg_t *msg_)
...
@@ -229,6 +229,8 @@ int zmq::stream_t::xrecv (msg_t *msg_)
// Rather than sendig this frame, we keep it in prefetched
// Rather than sendig this frame, we keep it in prefetched
// buffer and send a frame with peer's ID.
// buffer and send a frame with peer's ID.
blob_t
identity
=
pipe
->
get_identity
();
blob_t
identity
=
pipe
->
get_identity
();
rc
=
msg_
->
close
();
errno_assert
(
rc
==
0
);
rc
=
msg_
->
init_size
(
identity
.
size
());
rc
=
msg_
->
init_size
(
identity
.
size
());
errno_assert
(
rc
==
0
);
errno_assert
(
rc
==
0
);
...
...
tests/test_client_server.cpp
View file @
18791f2b
...
@@ -56,6 +56,8 @@ int main (void)
...
@@ -56,6 +56,8 @@ int main (void)
rc
=
zmq_msg_send
(
&
msg
,
client
,
0
);
rc
=
zmq_msg_send
(
&
msg
,
client
,
0
);
assert
(
rc
==
1
);
assert
(
rc
==
1
);
rc
=
zmq_msg_init
(
&
msg
);
assert
(
rc
==
0
);
rc
=
zmq_msg_recv
(
&
msg
,
server
,
0
);
rc
=
zmq_msg_recv
(
&
msg
,
server
,
0
);
assert
(
rc
==
1
);
assert
(
rc
==
1
);
...
@@ -80,6 +82,9 @@ int main (void)
...
@@ -80,6 +82,9 @@ int main (void)
rc
=
zmq_msg_recv
(
&
msg
,
client
,
0
);
rc
=
zmq_msg_recv
(
&
msg
,
client
,
0
);
assert
(
rc
==
1
);
assert
(
rc
==
1
);
rc
=
zmq_msg_close
(
&
msg
);
assert
(
rc
==
0
);
rc
=
zmq_close
(
server
);
rc
=
zmq_close
(
server
);
assert
(
rc
==
0
);
assert
(
rc
==
0
);
...
...
tests/test_srcfd.cpp
View file @
18791f2b
...
@@ -75,6 +75,9 @@ int main (void)
...
@@ -75,6 +75,9 @@ int main (void)
int
srcFd
=
zmq_msg_get
(
&
msg
,
ZMQ_SRCFD
);
int
srcFd
=
zmq_msg_get
(
&
msg
,
ZMQ_SRCFD
);
assert
(
srcFd
>=
0
);
assert
(
srcFd
>=
0
);
rc
=
zmq_msg_close
(
&
msg
);
assert
(
rc
==
0
);
// get the remote endpoint
// get the remote endpoint
struct
sockaddr_storage
ss
;
struct
sockaddr_storage
ss
;
#ifdef ZMQ_HAVE_HPUX
#ifdef ZMQ_HAVE_HPUX
...
...
tests/test_stream_disconnect.cpp
View file @
18791f2b
...
@@ -91,6 +91,8 @@ int main(int, char**)
...
@@ -91,6 +91,8 @@ int main(int, char**)
assert
(
rc
!=
-
1
);
assert
(
rc
!=
-
1
);
assert
(
zmq_msg_size
(
&
peer_frame
)
>
0
);
assert
(
zmq_msg_size
(
&
peer_frame
)
>
0
);
assert
(
has_more
(
sockets
[
SERVER
]));
assert
(
has_more
(
sockets
[
SERVER
]));
rc
=
zmq_msg_close
(
&
peer_frame
);
assert
(
rc
==
0
);
// Server: Grab the 2nd frame (actual payload).
// Server: Grab the 2nd frame (actual payload).
zmq_msg_t
data_frame
;
zmq_msg_t
data_frame
;
...
@@ -99,6 +101,8 @@ int main(int, char**)
...
@@ -99,6 +101,8 @@ int main(int, char**)
rc
=
zmq_msg_recv
(
&
data_frame
,
sockets
[
SERVER
],
0
);
rc
=
zmq_msg_recv
(
&
data_frame
,
sockets
[
SERVER
],
0
);
assert
(
rc
!=
-
1
);
assert
(
rc
!=
-
1
);
assert
(
zmq_msg_size
(
&
data_frame
)
==
0
);
assert
(
zmq_msg_size
(
&
data_frame
)
==
0
);
rc
=
zmq_msg_close
(
&
data_frame
);
assert
(
rc
==
0
);
// Client: Grab the 1st frame (peer identity).
// Client: Grab the 1st frame (peer identity).
rc
=
zmq_msg_init
(
&
peer_frame
);
rc
=
zmq_msg_init
(
&
peer_frame
);
...
@@ -107,6 +111,8 @@ int main(int, char**)
...
@@ -107,6 +111,8 @@ int main(int, char**)
assert
(
rc
!=
-
1
);
assert
(
rc
!=
-
1
);
assert
(
zmq_msg_size
(
&
peer_frame
)
>
0
);
assert
(
zmq_msg_size
(
&
peer_frame
)
>
0
);
assert
(
has_more
(
sockets
[
CLIENT
]));
assert
(
has_more
(
sockets
[
CLIENT
]));
rc
=
zmq_msg_close
(
&
peer_frame
);
assert
(
rc
==
0
);
// Client: Grab the 2nd frame (actual payload).
// Client: Grab the 2nd frame (actual payload).
rc
=
zmq_msg_init
(
&
data_frame
);
rc
=
zmq_msg_init
(
&
data_frame
);
...
@@ -114,6 +120,8 @@ int main(int, char**)
...
@@ -114,6 +120,8 @@ int main(int, char**)
rc
=
zmq_msg_recv
(
&
data_frame
,
sockets
[
CLIENT
],
0
);
rc
=
zmq_msg_recv
(
&
data_frame
,
sockets
[
CLIENT
],
0
);
assert
(
rc
!=
-
1
);
assert
(
rc
!=
-
1
);
assert
(
zmq_msg_size
(
&
data_frame
)
==
0
);
assert
(
zmq_msg_size
(
&
data_frame
)
==
0
);
rc
=
zmq_msg_close
(
&
data_frame
);
assert
(
rc
==
0
);
// Send initial message.
// Send initial message.
char
blob_data
[
256
];
char
blob_data
[
256
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment