Skip to content

Commit

Permalink
fix(us): memory leak when getting root certificate (#16073)
Browse files Browse the repository at this point in the history
  • Loading branch information
DonIsaac authored Dec 31, 2024
1 parent e96dded commit ab52058
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/bun-usockets/src/crypto/root_certs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ us_ssl_ctx_get_X509_without_callback_from(struct us_cert_string_t content) {
OPENSSL_PUT_ERROR(SSL, ERR_R_PEM_LIB);
goto end;
}

// NOTE: PEM_read_bio_X509 allocates, so input BIO must be freed.
BIO_free(in);
return x;
end:
X509_free(x);
Expand Down Expand Up @@ -140,4 +143,4 @@ extern "C" X509_STORE *us_get_default_ca_store() {
}

return store;
}
}

0 comments on commit ab52058

Please sign in to comment.