summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorStefan Berger <stefanb@linux.vnet.ibm.com>2018-11-12 09:20:44 -0500
committerStefan Berger <stefanb@linux.vnet.ibm.com>2018-11-12 11:20:31 -0500
commit610479fe408be9a3a714df8a650263fd7e0e36f0 (patch)
tree1b6fda48f15444cfe8377d1b737924feb625ce25 /lib
parent907086568631afa552baf198496f364307de1220 (diff)
downloadgnutls-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>
Diffstat (limited to 'lib')
-rw-r--r--lib/tpm.c5
1 files changed, 0 insertions, 5 deletions
diff --git a/lib/tpm.c b/lib/tpm.c
index ee53c71540..95bed111af 100644
--- a/lib/tpm.c
+++ b/lib/tpm.c
@@ -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);