aboutsummaryrefslogtreecommitdiffstats
path: root/tools/cert_create
diff options
context:
space:
mode:
authorJimmy Brisson <jimmy.brisson@arm.com>2020-07-27 11:23:20 -0500
committerManish Pandey <manish.pandey2@arm.com>2020-10-20 20:17:35 +0000
commit4a34d18f35b76f1df282b1a077ad749d13c1d19d (patch)
tree54c24865b5b5fc0a645180a0c39afcd9c3002bdc /tools/cert_create
parent1f111f12b5ecc69670653763512e557f59f88ef9 (diff)
downloadplatform_external_arm-trusted-firmware-4a34d18f35b76f1df282b1a077ad749d13c1d19d.tar.gz
platform_external_arm-trusted-firmware-4a34d18f35b76f1df282b1a077ad749d13c1d19d.tar.bz2
platform_external_arm-trusted-firmware-4a34d18f35b76f1df282b1a077ad749d13c1d19d.zip
Free arguments copied with strdup
Change-Id: I0ad9620145c2a9c4450b9bf20cd1f70c9db6593c Signed-off-by: Jimmy Brisson <jimmy.brisson@arm.com>
Diffstat (limited to 'tools/cert_create')
-rw-r--r--tools/cert_create/src/main.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/cert_create/src/main.c b/tools/cert_create/src/main.c
index 31978a995..d5abe4917 100644
--- a/tools/cert_create/src/main.c
+++ b/tools/cert_create/src/main.c
@@ -593,5 +593,32 @@ int main(int argc, char *argv[])
#endif
CRYPTO_cleanup_all_ex_data();
+
+ /* We allocated strings through strdup, so now we have to free them */
+ for (i = 0; i < num_keys; i++) {
+ if (keys[i].fn != NULL) {
+ void *ptr = keys[i].fn;
+
+ keys[i].fn = NULL;
+ free(ptr);
+ }
+ }
+ for (i = 0; i < num_extensions; i++) {
+ if (extensions[i].arg != NULL) {
+ void *ptr = (void *)extensions[i].arg;
+
+ extensions[i].arg = NULL;
+ free(ptr);
+ }
+ }
+ for (i = 0; i < num_certs; i++) {
+ if (certs[i].fn != NULL) {
+ void *ptr = (void *)certs[i].fn;
+
+ certs[i].fn = NULL;
+ free(ptr);
+ }
+ }
+
return 0;
}