aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Chadwell <justin.chadwell@arm.com>2019-08-12 12:19:21 +0100
committerJustin Chadwell <justin.chadwell@arm.com>2019-08-16 14:11:18 +0100
commit65ec13bce1367795bb0926561caca27de210e534 (patch)
treea63332a1d6d594696978f0e5d91d44afdfa39ba9
parentd1b6013d8485094d948e6b6039b8d119a907ecf8 (diff)
downloadtrusted-firmware-a-65ec13bce1367795bb0926561caca27de210e534.tar.gz
Reduce the number of memory leaks in cert_create
The valgrind checks for cert_create have not been run in a long while - as such there are a few memory leaks present. This patch fixes a few of the major ones reported by valgrind. However, a few do remain. Change-Id: Iab002fb2b0090043287d43fb54a4d18928c2ed85 Signed-off-by: Justin Chadwell <justin.chadwell@arm.com>
-rw-r--r--tools/cert_create/src/ext.c3
-rw-r--r--tools/cert_create/src/key.c3
-rw-r--r--tools/cert_create/src/main.c2
3 files changed, 5 insertions, 3 deletions
diff --git a/tools/cert_create/src/ext.c b/tools/cert_create/src/ext.c
index 055ddbfd0..57fb47d1d 100644
--- a/tools/cert_create/src/ext.c
+++ b/tools/cert_create/src/ext.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2015-2019, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -284,6 +284,7 @@ X509_EXTENSION *ext_new_key(int nid, int crit, EVP_PKEY *k)
ex = ext_new(nid, crit, p, sz);
/* Clean up */
+ BIO_free(mem);
OPENSSL_free(p);
return ex;
diff --git a/tools/cert_create/src/key.c b/tools/cert_create/src/key.c
index 871f9ee8b..fece77085 100644
--- a/tools/cert_create/src/key.c
+++ b/tools/cert_create/src/key.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2015-2019, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -73,6 +73,7 @@ static int key_create_rsa(key_t *key)
goto err;
}
+ BN_free(e);
return 1;
err:
RSA_free(rsa);
diff --git a/tools/cert_create/src/main.c b/tools/cert_create/src/main.c
index ed566207c..0f588cc8c 100644
--- a/tools/cert_create/src/main.c
+++ b/tools/cert_create/src/main.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2015-2019, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/