Browse Source

Free arguments copied with strdup

Change-Id: I0ad9620145c2a9c4450b9bf20cd1f70c9db6593c
Signed-off-by: Jimmy Brisson <jimmy.brisson@arm.com>
pull/1940/head
Jimmy Brisson 4 years ago
committed by Manish Pandey
parent
commit
4a34d18f35
  1. 27
      tools/cert_create/src/main.c

27
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;
}

Loading…
Cancel
Save