diff options
| -rw-r--r-- | cmake/CheckSanitizer.cmake | 4 | ||||
| -rw-r--r-- | src/platform/posix/posix_resolv_gai.c | 3 | ||||
| -rw-r--r-- | src/platform/windows/win_resolv.c | 3 | ||||
| -rw-r--r-- | src/protocol/reqrep0/reqrep_test.c | 4 | ||||
| -rw-r--r-- | src/supplemental/websocket/websocket_test.c | 2 | ||||
| -rw-r--r-- | tests/httpserver.c | 15 | ||||
| -rw-r--r-- | tests/ipcsupp.c | 3 | ||||
| -rw-r--r-- | tests/message.c | 5 | ||||
| -rw-r--r-- | tests/sock.c | 1 | ||||
| -rw-r--r-- | tests/tcpsupp.c | 1 |
10 files changed, 29 insertions, 12 deletions
diff --git a/cmake/CheckSanitizer.cmake b/cmake/CheckSanitizer.cmake index a6b3501f..b4d4f320 100644 --- a/cmake/CheckSanitizer.cmake +++ b/cmake/CheckSanitizer.cmake @@ -1,5 +1,5 @@ # -# Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> +# Copyright 2019 Staysail Systems, Inc. <info@staysail.tech> # Copyright 2017 Capitar IT Group BV <info@capitar.com> # # This software is supplied under the terms of the MIT License, a @@ -24,7 +24,7 @@ macro (CheckSanitizer) mark_as_advanced (NNG_SANITIZER) if (NOT NNG_SANITIZER STREQUAL "none") - set (NNG_C_FLAG_SANITIZER "-fsanitizer=${NNG_SANITIZER}") + set (NNG_C_FLAG_SANITIZER "-fsanitize=${NNG_SANITIZER}") message(STATUS "Enabling sanitizer: ${NNG_C_FLAG_SANITIZER}") endif() endmacro () diff --git a/src/platform/posix/posix_resolv_gai.c b/src/platform/posix/posix_resolv_gai.c index 9e577403..aa70a916 100644 --- a/src/platform/posix/posix_resolv_gai.c +++ b/src/platform/posix/posix_resolv_gai.c @@ -337,9 +337,8 @@ resolv_worker(void *notused) nni_aio_set_sockaddr(aio, &item->sa); nni_aio_finish(aio, rv, 0); - - NNI_FREE_STRUCT(item); } + NNI_FREE_STRUCT(item); } nni_mtx_unlock(&resolv_mtx); } diff --git a/src/platform/windows/win_resolv.c b/src/platform/windows/win_resolv.c index 53a39118..745f03d1 100644 --- a/src/platform/windows/win_resolv.c +++ b/src/platform/windows/win_resolv.c @@ -300,9 +300,8 @@ resolv_worker(void *notused) item->aio = NULL; nni_aio_finish(aio, rv, 0); - - NNI_FREE_STRUCT(item); } + NNI_FREE_STRUCT(item); } nni_mtx_unlock(&resolv_mtx); } diff --git a/src/protocol/reqrep0/reqrep_test.c b/src/protocol/reqrep0/reqrep_test.c index 09ba9ba3..b68c08cb 100644 --- a/src/protocol/reqrep0/reqrep_test.c +++ b/src/protocol/reqrep0/reqrep_test.c @@ -35,8 +35,10 @@ test_req_rep_identity(void) TEST_CHECK(p == NNI_PROTO(3u, 1u)); // 49 TEST_CHECK(nng_getopt_string(s, NNG_OPT_PROTONAME, &n) == 0); TEST_CHECK(strcmp(n, "req") == 0); + nng_strfree(n); TEST_CHECK(nng_getopt_string(s, NNG_OPT_PEERNAME, &n) == 0); TEST_CHECK(strcmp(n, "rep") == 0); + nng_strfree(n); TEST_CHECK(nng_close(s) == 0); TEST_CHECK(nng_rep0_open(&s) == 0); @@ -46,8 +48,10 @@ test_req_rep_identity(void) TEST_CHECK(p == NNI_PROTO(3u, 0u)); // 48 TEST_CHECK(nng_getopt_string(s, NNG_OPT_PROTONAME, &n) == 0); TEST_CHECK(strcmp(n, "rep") == 0); + nng_strfree(n); TEST_CHECK(nng_getopt_string(s, NNG_OPT_PEERNAME, &n) == 0); TEST_CHECK(strcmp(n, "req") == 0); + nng_strfree(n); TEST_CHECK(nng_close(s) == 0); } diff --git a/src/supplemental/websocket/websocket_test.c b/src/supplemental/websocket/websocket_test.c index 831c6d43..9d99f2c2 100644 --- a/src/supplemental/websocket/websocket_test.c +++ b/src/supplemental/websocket/websocket_test.c @@ -337,8 +337,6 @@ test_websocket_fragmentation(void) nng_stream_listener_set_size(l, NNG_OPT_WS_SENDMAXFRAME, 1000000)); TEST_NNG_PASS(nng_stream_listener_listen(l)); - TEST_NNG_PASS(nng_aio_alloc(&laio, NULL, NULL)); - TEST_NNG_PASS(nng_aio_alloc(&daio, NULL, NULL)); nng_aio_set_timeout(laio, 2000); nng_aio_set_timeout(daio, 2000); diff --git a/tests/httpserver.c b/tests/httpserver.c index 996d20b4..a69889a5 100644 --- a/tests/httpserver.c +++ b/tests/httpserver.c @@ -353,7 +353,7 @@ TestMain("HTTP Server", { So(size == strlen(doc1)); So(memcmp(data, doc1, size) == 0); So(strcmp(ctype, "text/html") == 0); - free(ctype); + nng_strfree(ctype); nng_free(data, size); }); @@ -403,6 +403,8 @@ TestMain("HTTP Server", { snprintf(fullurl, sizeof(fullurl), "%s/docs/", urlstr); So(httpget(fullurl, &data, &size, &stat, &ctype) == 0); So(stat == NNG_HTTP_STATUS_NOT_FOUND); + nng_strfree(ctype); + nng_free(data, size); }); Convey("Custom error page works", { @@ -418,6 +420,8 @@ TestMain("HTTP Server", { So(stat == NNG_HTTP_STATUS_NOT_FOUND); So(size == strlen(doc4)); So(memcmp(data, doc4, size) == 0); + nng_strfree(ctype); + nng_free(data, size); }); Convey("Bad method gives 405", { @@ -440,6 +444,7 @@ TestMain("HTTP Server", { nng_http_req_free(req); nng_http_res_free(res); nng_url_free(curl); + nng_free(data, size); }); Convey("Version 0.9 gives 505", { char fullurl[256]; @@ -461,6 +466,7 @@ TestMain("HTTP Server", { nng_http_req_free(req); nng_http_res_free(res); nng_url_free(curl); + nng_free(data, size); }); Convey("Missing Host gives 400", { char fullurl[256]; @@ -482,6 +488,7 @@ TestMain("HTTP Server", { nng_http_req_free(req); nng_http_res_free(res); nng_url_free(curl); + nng_free(data, size); }); }); @@ -529,6 +536,7 @@ TestMain("HTTP Server", { nng_http_req_free(req); nng_http_res_free(res); nng_url_free(curl); + nng_free(rxdata, size); }); Convey("Get method gives 405", { @@ -551,6 +559,7 @@ TestMain("HTTP Server", { nng_http_req_free(req); nng_http_res_free(res); nng_url_free(curl); + nng_free(data, size); }); }); @@ -598,6 +607,7 @@ TestMain("HTTP Server", { nng_http_req_free(req); nng_http_res_free(res); nng_url_free(curl); + nng_free(data, size); }); Convey("Tree redirect works", { @@ -633,6 +643,7 @@ TestMain("HTTP Server", { nng_http_req_free(req); nng_http_res_free(res); nng_url_free(curl); + nng_free(data, size); }); Convey("POST Redirect works", { @@ -667,6 +678,7 @@ TestMain("HTTP Server", { nng_http_req_free(req); nng_http_res_free(res); nng_url_free(curl); + nng_free(data, size); }); }); @@ -714,6 +726,7 @@ TestMain("HTTP Server", { nng_http_req_free(req); nng_http_res_free(res); nng_url_free(curl); + nng_free(rxdata, size); }); }); }); diff --git a/tests/ipcsupp.c b/tests/ipcsupp.c index bb7d92f7..d5128098 100644 --- a/tests/ipcsupp.c +++ b/tests/ipcsupp.c @@ -51,7 +51,8 @@ TestMain("Supplemental IPC", { Reset({ nng_aio_free(daio); - nng_aio_free(laio); + nng_aio_free(laio); + nng_aio_free(maio); if (c1 != NULL) { nng_stream_close(c1); nng_stream_free(c1); diff --git a/tests/message.c b/tests/message.c index cc50f542..4dfc9921 100644 --- a/tests/message.c +++ b/tests/message.c @@ -1,5 +1,5 @@ // -// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2019 Staysail Systems, Inc. <info@staysail.tech> // Copyright 2018 Capitar IT Group BV <info@capitar.com> // // This software is supplied under the terms of the MIT License, a @@ -187,11 +187,12 @@ TestMain("Message Tests", { }); Convey("Message dup copies pipe", { - nng_pipe p = NNG_PIPE_INITIALIZER; + nng_pipe p = NNG_PIPE_INITIALIZER; nng_msg *m2; memset(&p, 0x22, sizeof(p)); nng_msg_set_pipe(msg, p); So(nng_msg_dup(&m2, msg) == 0); + Reset({ nng_msg_free(m2); }); p = nng_msg_get_pipe(m2); So(nng_pipe_id(p) == 0x22222222); }); diff --git a/tests/sock.c b/tests/sock.c index cf3cc705..b6b981c8 100644 --- a/tests/sock.c +++ b/tests/sock.c @@ -82,6 +82,7 @@ test_send_nonblock(void) TEST_CHECK(nng_sendmsg(s1, msg, NNG_FLAG_NONBLOCK) == NNG_EAGAIN); TEST_CHECK(testutil_clock() < (now + 100)); TEST_CHECK(nng_close(s1) == 0); + nng_msg_free(msg); } void diff --git a/tests/tcpsupp.c b/tests/tcpsupp.c index e25383c5..39558f58 100644 --- a/tests/tcpsupp.c +++ b/tests/tcpsupp.c @@ -66,6 +66,7 @@ TestMain("Supplemental TCP", { Reset({ nng_aio_free(daio); nng_aio_free(laio); + nng_aio_free(maio); if (c1 != NULL) { nng_stream_close(c1); nng_stream_free(c1); |
