summaryrefslogtreecommitdiff
path: root/test/cctest
diff options
context:
space:
mode:
authorEugene Ostroukhov <eostroukhov@chromium.org>2016-12-12 10:51:18 -0800
committerEugene Ostroukhov <eostroukhov@chromium.org>2016-12-14 09:54:07 -0800
commit3c29b2f8512d4d2d702a2a2f985106a312818ddc (patch)
treeeca08433f8a78efc5f561df23f5f0e0e93ad1d6c /test/cctest
parentb79e83e7f6458fe5bb180731a2fdb9341a22514e (diff)
downloadnode-new-3c29b2f8512d4d2d702a2a2f985106a312818ddc.tar.gz
inspector: fix Coverity defects
One defect remains - Coverity believes that a session object is never freed while in reality its lifespan is tied to a libuv socket. PR-URL: https://github.com/nodejs/node/pull/10240 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Diffstat (limited to 'test/cctest')
-rw-r--r--test/cctest/test_inspector_socket.cc10
-rw-r--r--test/cctest/test_inspector_socket_server.cc4
2 files changed, 8 insertions, 6 deletions
diff --git a/test/cctest/test_inspector_socket.cc b/test/cctest/test_inspector_socket.cc
index ada3df3d43..b61fbd2cd6 100644
--- a/test/cctest/test_inspector_socket.cc
+++ b/test/cctest/test_inspector_socket.cc
@@ -370,13 +370,13 @@ class InspectorSocketTest : public ::testing::Test {
uv_tcp_init(&loop, &client_socket);
uv_ip4_addr("127.0.0.1", PORT, &addr);
uv_tcp_bind(&server, reinterpret_cast<const struct sockaddr*>(&addr), 0);
- int err = uv_listen(reinterpret_cast<uv_stream_t*>(&server),
- 1, on_new_connection);
- GTEST_ASSERT_EQ(0, err);
+ GTEST_ASSERT_EQ(0, uv_listen(reinterpret_cast<uv_stream_t*>(&server),
+ 1, on_new_connection));
uv_connect_t connect;
connect.data = nullptr;
- uv_tcp_connect(&connect, &client_socket,
- reinterpret_cast<const sockaddr*>(&addr), on_connection);
+ GTEST_ASSERT_EQ(0, uv_tcp_connect(&connect, &client_socket,
+ reinterpret_cast<const sockaddr*>(&addr),
+ on_connection));
uv_tcp_nodelay(&client_socket, 1); // The buffering messes up the test
SPIN_WHILE(!connect.data || !connected);
really_close(reinterpret_cast<uv_handle_t*>(&server));
diff --git a/test/cctest/test_inspector_socket_server.cc b/test/cctest/test_inspector_socket_server.cc
index d253df5dd9..2bbc381139 100644
--- a/test/cctest/test_inspector_socket_server.cc
+++ b/test/cctest/test_inspector_socket_server.cc
@@ -86,7 +86,8 @@ class TestInspectorServerDelegate : public SocketServerDelegate {
public:
TestInspectorServerDelegate() : connected(0), disconnected(0),
targets_({ MAIN_TARGET_ID,
- UNCONNECTABLE_TARGET_ID }) {}
+ UNCONNECTABLE_TARGET_ID }),
+ session_id_(0) {}
void Connect(InspectorSocketServer* server) {
server_ = server;
@@ -152,6 +153,7 @@ class SocketWrapper {
explicit SocketWrapper(uv_loop_t* loop) : closed_(false),
eof_(false),
loop_(loop),
+ socket_(uv_tcp_t()),
connected_(false),
sending_(false) { }