Skip to content

Commit 194a676

Browse files
devnexenwlallemand
authored andcommitted
BUG/MINOR: acme: fix X509_NAME leak when X509_set_issuer_name() fails
In acme_gen_tmp_x509(), if X509_set_issuer_name() fails, the code jumped to the mkcert_error label without freeing the previously allocated X509_NAME object. The other error paths after X509_NAME_new() (X509_NAME_add_entry_by_txt and X509_set_subject_name) already properly freed the name before jumping to mkcert_error, but this one was missed. Fix this by freeing name before the goto, consistent with the other error paths in the same function. Must be backported as far as 3.3.
1 parent 92e3635 commit 194a676

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/acme.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2681,8 +2681,10 @@ X509 *acme_gen_tmp_x509()
26812681
goto mkcert_error;
26822682
}
26832683
/* Set issuer name as itself */
2684-
if (X509_set_issuer_name(newcrt, name) != 1)
2684+
if (X509_set_issuer_name(newcrt, name) != 1) {
2685+
X509_NAME_free(name);
26852686
goto mkcert_error;
2687+
}
26862688
X509_NAME_free(name);
26872689

26882690
/* Autosign the certificate with the private key */

0 commit comments

Comments
 (0)