Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/x509/clu_ca_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ int wolfCLU_CASetup(int argc, char** argv)
if (selfSigned) {
wolfCLU_CertSignSetCA(signer, x509, pkey,
wolfCLU_GetTypeFromPKEY(pkey));
pkey = NULL; /* ownership transferred to signer */
}
Comment on lines 286 to 290
Comment on lines 286 to 290
else if (altSign) {
char* subjName = wolfSSL_X509_NAME_oneline(
Expand All @@ -302,6 +303,8 @@ int wolfCLU_CASetup(int argc, char** argv)
else {
wolfCLU_CertSignSetCA(signer, ca, pkey,
wolfCLU_GetTypeFromPKEY(pkey));
ca = NULL; /* ownership transferred to signer */
pkey = NULL; /* ownership transferred to signer */
}
Comment on lines 303 to 308
}

Expand Down Expand Up @@ -335,9 +338,12 @@ int wolfCLU_CASetup(int argc, char** argv)
if (!selfSigned) {
wolfSSL_X509_free(x509);
}
if ((selfSigned || altSign) && ca != NULL) {
if (ca != NULL) {
wolfSSL_X509_free(ca);
}
if (pkey != NULL) {
wolfSSL_EVP_PKEY_free(pkey);
}

/* check for success on signer free since random data is output */
if (wolfCLU_CertSignFree(signer) != WOLFCLU_SUCCESS) {
Expand Down
Loading