diff options
author | Stefan Berger <stefanb@linux.vnet.ibm.com> | 2018-11-12 09:20:44 -0500 |
---|---|---|
committer | Stefan Berger <stefanb@linux.vnet.ibm.com> | 2018-11-12 11:20:31 -0500 |
commit | 610479fe408be9a3a714df8a650263fd7e0e36f0 (patch) | |
tree | 1b6fda48f15444cfe8377d1b737924feb625ce25 | |
parent | 907086568631afa552baf198496f364307de1220 (diff) | |
download | gnutls-610479fe408be9a3a714df8a650263fd7e0e36f0.tar.gz |
tpm: Fix memory leak in encode_tpmkey_url
When returning the key URL in encode_tpm_key_url we do not need to allocate
a separate buffer for the URL since we return the allocated buffer from
_gnutls_buffer_to_datum().
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
-rw-r--r-- | lib/tpm.c | 5 |
1 files changed, 0 insertions, 5 deletions
@@ -839,16 +839,11 @@ static int randomize_uuid(TSS_UUID * uuid) static int encode_tpmkey_url(char **url, const TSS_UUID * uuid, TSS_FLAG storage) { - size_t size = (UUID_SIZE * 2 + 4) * 2 + 32; uint8_t u1[UUID_SIZE]; gnutls_buffer_st buf; gnutls_datum_t dret; int ret; - *url = gnutls_malloc(size); - if (*url == NULL) - return gnutls_assert_val(GNUTLS_E_MEMORY_ERROR); - _gnutls_buffer_init(&buf); memcpy(u1, &uuid->ulTimeLow, 4); |