Fix a pair of remaining leaks in tortls_nss.c

Fun fact: PR_Close leaks memory if its socket is not valid.
This commit is contained in:
Nick Mathewson
2018-09-04 19:23:55 -04:00
parent 274efb1263
commit c50537fd94
2 changed files with 9 additions and 1 deletions
+7 -1
View File
@@ -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;
+2
View File
@@ -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;