sock/posix: free the allocated memory
Related reference: OPENSSL_hexstr2buf() does the same thing as OPENSSL_hexstr2buf_ex(), but allocates the space for the result, and returns the result. It uses a default separator of ':'. The memory is allocated by calling OPENSSL_malloc() and should be released by calling OPENSSL_free(). Change-Id: I0d2b9b66a41e53f8b438470e59a478c17df2e1e6 Signed-off-by: GangCao <gang.cao@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15647 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: wanghailiang <hailiangx.e.wang@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com> Community-CI: Mellanox Build Bot
This commit is contained in:
parent
46ff15a658
commit
cb9f9f4c04
@ -546,10 +546,12 @@ posix_sock_tls_psk_server_cb(SSL *ssl,
|
||||
}
|
||||
if (key_len > max_psk_len) {
|
||||
SPDK_ERRLOG("Insufficient buffer size to copy PSK\n");
|
||||
OPENSSL_free(default_psk);
|
||||
goto err;
|
||||
}
|
||||
|
||||
memcpy(psk, default_psk, key_len);
|
||||
OPENSSL_free(default_psk);
|
||||
|
||||
return key_len;
|
||||
|
||||
@ -585,6 +587,7 @@ posix_sock_tls_psk_client_cb(SSL *ssl, const char *hint,
|
||||
}
|
||||
if ((strlen(impl_opts->psk_identity) + 1 > max_identity_len)
|
||||
|| (key_len > max_psk_len)) {
|
||||
OPENSSL_free(default_psk);
|
||||
SPDK_ERRLOG("PSK ID or Key buffer is not sufficient\n");
|
||||
goto err;
|
||||
}
|
||||
@ -593,6 +596,7 @@ posix_sock_tls_psk_client_cb(SSL *ssl, const char *hint,
|
||||
|
||||
memcpy(psk, default_psk, key_len);
|
||||
SPDK_DEBUGLOG(sock_posix, "Provided out-of-band (OOB) PSK for TLS1.3 client\n");
|
||||
OPENSSL_free(default_psk);
|
||||
|
||||
return key_len;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user