Skip to content

Commit

Permalink
Fix memory leaks in ssl_old_test.c
Browse files Browse the repository at this point in the history
This fixes a few memory leaks reported in openssl#22049.

If SSL_CTX_set0_tmp_dh_pkey rejects the temp dh key
due to security restrictions (even when @SECLEVEL=0 is used!)
then the caller has to delete the PKEY object.
That is different to how the deprecated
SSL_CTX_set_tmp_dh_pkey was designed to work.

Reviewed-by: Tomas Mraz <[email protected]>
Reviewed-by: Paul Dale <[email protected]>
(Merged from openssl#22060)
  • Loading branch information
bernd-edlinger committed Sep 13, 2023
1 parent 2508629 commit 21f0b80
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/ssl_old_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -1535,8 +1535,10 @@ int main(int argc, char *argv[])
ERR_print_errors(bio_err);
goto end;
}
SSL_CTX_set0_tmp_dh_pkey(s_ctx, dhpkey);
SSL_CTX_set0_tmp_dh_pkey(s_ctx2, dhpkey);
if (!SSL_CTX_set0_tmp_dh_pkey(s_ctx, dhpkey))
EVP_PKEY_free(dhpkey);
if (!SSL_CTX_set0_tmp_dh_pkey(s_ctx2, dhpkey))
EVP_PKEY_free(dhpkey);
}
#endif

Expand Down

0 comments on commit 21f0b80

Please sign in to comment.