Skip to content

Commit

Permalink
Fix memory leaks on OSSL_SERIALIZER_CTX_new_by_EVP_PKEY
Browse files Browse the repository at this point in the history
Fixes openssl#12303

Reviewed-by: Richard Levitte <[email protected]>
(Merged from openssl#12304)
  • Loading branch information
romen committed Jul 2, 2020
1 parent 94941ca commit 587e4e5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions crypto/serializer/serializer_pkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,6 @@ OSSL_SERIALIZER_CTX *OSSL_SERIALIZER_CTX_new_by_EVP_PKEY(const EVP_PKEY *pkey,
const OSSL_PROVIDER *desired_prov = EVP_KEYMGMT_provider(keymgmt);
OPENSSL_CTX *libctx = ossl_provider_library_context(desired_prov);
struct selected_serializer_st sel_data;
OSSL_PROPERTY_LIST *check = ossl_parse_query(libctx, "type=parameters");
OSSL_PROPERTY_LIST *current_props = NULL;
OSSL_SERIALIZER *first = NULL;
const char *name;
int i;
Expand Down Expand Up @@ -347,6 +345,9 @@ OSSL_SERIALIZER_CTX *OSSL_SERIALIZER_CTX_new_by_EVP_PKEY(const EVP_PKEY *pkey,
ser = first;

if (ser != NULL) {
OSSL_PROPERTY_LIST *check = NULL, *current_props = NULL;

check = ossl_parse_query(libctx, "type=parameters");
current_props =
ossl_parse_property(libctx, OSSL_SERIALIZER_properties(ser));
if (ossl_property_match_count(check, current_props) > 0)
Expand Down

0 comments on commit 587e4e5

Please sign in to comment.