Skip to content

crypto\cms\cms_kem.c: Add ASN1_TYPE_free when EVP_CIPHER_param_to_asn… #28210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Nachel72
Copy link

@Nachel72 Nachel72 commented Aug 8, 2025

…1() fails
Fixed a memory leak caused by wrap->parameter not being freed.

CLA: trivial

@openssl-machine openssl-machine added the hold: cla required The contributor needs to submit a license agreement label Aug 8, 2025
@openssl-machine openssl-machine added hold: cla required The contributor needs to submit a license agreement and removed hold: cla required The contributor needs to submit a license agreement labels Aug 8, 2025
@openssl-machine openssl-machine removed the hold: cla required The contributor needs to submit a license agreement label Aug 9, 2025
Comment on lines 138 to 141
if (EVP_CIPHER_param_to_asn1(kekctx, wrap->parameter) <= 0)
ASN1_TYPE_free(wrap->parameter);
wrap->parameter = NULL;
goto err;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You did not add {} around the intended block!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I think the subsequent ASN1_TYPE_get() check actually does what this is fixing.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added {}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I think the subsequent ASN1_TYPE_get() check actually does what this is fixing.

When EVP_CIPHER_param_to_asn1() fails, jump directly to the err label. So the subsequent ASN1_TYPE_get() check does not work.

…1() fails

Signed-off-by: Nachel72 <Nachel72@outlook.com>

CLA: trivial
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants