tools: eliminated memory leaks in deinitialization

parent 2dda25d9
Pipeline #4054005 passed with stage
in 149 minutes and 33 seconds
......@@ -1928,7 +1928,6 @@ static int cert_verify_ocsp(gnutls_session_t session)
}
for (it = 0; it < cert_list_size; it++) {
gnutls_x509_crt_init(&cert);
if (deinit_cert)
gnutls_x509_crt_deinit(cert);
gnutls_x509_crt_init(&cert);
......@@ -1975,6 +1974,7 @@ static int cert_verify_ocsp(gnutls_session_t session)
/* verify and check the response for revoked cert */
ret = check_ocsp_response(cert, issuer, &resp, &nonce, verbose);
free(resp.data);
if (ret == 1)
ok++;
else if (ret == 0) {
......
......@@ -222,7 +222,7 @@ int send_ocsp_request(const char *server,
return -1;
}
socket_bye(&hd, 1);
socket_bye(&hd, 0);
p = memmem(ud.data, ud.size, "\r\n\r\n", 4);
if (p == NULL) {
......
......@@ -332,6 +332,9 @@ void socket_bye(socket_st * socket, unsigned polite)
fprintf(stderr, "*** gnutls_bye() error: %s\n",
gnutls_strerror(ret));
}
}
if (socket->session) {
gnutls_deinit(socket->session);
socket->session = NULL;
}
......
Markdown is supported
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