Remove redundant free loop
This version is incomplete. I failed to noticed it when adding a more
complete version, making the existing one redundant.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
diff --git a/programs/x509/cert_req.c b/programs/x509/cert_req.c
index 605d78c5..89ab181 100644
--- a/programs/x509/cert_req.c
+++ b/programs/x509/cert_req.c
@@ -495,6 +495,14 @@
#endif
}
+ mbedtls_x509write_csr_free(&req);
+ mbedtls_pk_free(&key);
+ mbedtls_ctr_drbg_free(&ctr_drbg);
+ mbedtls_entropy_free(&entropy);
+#if defined(MBEDTLS_USE_PSA_CRYPTO)
+ mbedtls_psa_crypto_free();
+#endif /* MBEDTLS_USE_PSA_CRYPTO */
+
cur = opt.san_list;
while (cur != NULL) {
mbedtls_x509_san_list *next = cur->next;
@@ -512,22 +520,6 @@
cur = next;
}
- mbedtls_x509write_csr_free(&req);
- mbedtls_pk_free(&key);
- mbedtls_ctr_drbg_free(&ctr_drbg);
- mbedtls_entropy_free(&entropy);
-#if defined(MBEDTLS_USE_PSA_CRYPTO)
- mbedtls_psa_crypto_free();
-#endif /* MBEDTLS_USE_PSA_CRYPTO */
-
- cur = opt.san_list;
- while (cur != NULL) {
- prev = cur;
- cur = cur->next;
- mbedtls_free(prev);
- }
-
-
mbedtls_exit(exit_code);
}
#endif /* MBEDTLS_X509_CSR_WRITE_C && MBEDTLS_PK_PARSE_C && MBEDTLS_FS_IO &&