Commit c50537fd authored by Nick Mathewson's avatar Nick Mathewson 🏃
Browse files

Fix a pair of remaining leaks in tortls_nss.c

Fun fact: PR_Close leaks memory if its socket is not valid.
parent 274efb12
......@@ -361,7 +361,13 @@ tor_tls_new(tor_socket_t sock, int is_server)
(void)sock;
tor_tls_context_t *ctx = tor_tls_context_get(is_server);
PRFileDesc *tcp = PR_ImportTCPSocket(sock);
PRFileDesc *tcp = NULL;
if (SOCKET_OK(sock)) {
tcp = PR_ImportTCPSocket(sock);
} else {
tcp = PR_NewTCPSocket();
}
if (!tcp)
return NULL;
......
......@@ -52,6 +52,8 @@ NS(router_get_my_routerinfo)(void)
mock_routerinfo->onion_pkey = crypto_pk_dup_key(tap_key);
mock_routerinfo->bandwidthrate = 9001;
mock_routerinfo->bandwidthburst = 9002;
crypto_pk_free(ident_key);
crypto_pk_free(tap_key);
}
return mock_routerinfo;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment