Skip to content
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

Fix memory leaks related to openssl EC pathways #653

Conversation

jasonkatonica
Copy link
Contributor

@jasonkatonica jasonkatonica commented Mar 15, 2023

This update fixes a few memory leaks associated with the creation of
EC private and public keys.

This openssl api BN_bn2bin described here:

https://www.openssl.org/docs/man1.0.2/man3/BN_bin2bn.html

This api states that a new BIGNUM is created if the last argument
is null to the API. In our case the last argument is indeed null
so we are leaking memory in the EC paths since we never free the big
number returned.

A cleanup goto was also added to simplify the code and ensure that
all cleanup of allocated memory is done. We make explicit calls
to then free all allocated memory in the cleanup.

This is a cherry pick of:
ibmruntimes/openj9-openjdk-jdk@969654a

Signed-off-by: Jason Katonica katonica@us.ibm.com

@jasonkatonica
Copy link
Contributor Author

This fix is associated with the issue located at eclipse-openj9/openj9#16451

@jasonkatonica jasonkatonica marked this pull request as ready for review March 15, 2023 18:11
@jasonkatonica jasonkatonica force-pushed the katonica/issue73or16451/ECmemoryleak branch 2 times, most recently from b4a3040 to 6e0b0a3 Compare March 17, 2023 10:12
This update fixes a few memory leaks associated with the creation of
EC private and public keys.

This openssl api BN_bn2bin described here:

https://www.openssl.org/docs/man1.0.2/man3/BN_bin2bn.html

This api states that a new BIGNUM is created if the last argument
is null to the API. In our case the last argument is indeed null
so we are leaking memory in the EC paths since we never free the big
number returned.

A cleanup goto was also added to simplify the code and ensure that
all cleanup of allocated memory is done. We make explicit calls
to then free all allocated memory in the cleanup.

This is a cherry pick of:
ibmruntimes/openj9-openjdk-jdk@969654a

Signed-off-by: Jason Katonica katonica@us.ibm.com
@jasonkatonica jasonkatonica force-pushed the katonica/issue73or16451/ECmemoryleak branch from 6e0b0a3 to b259e4d Compare March 17, 2023 10:14
@jasonkatonica
Copy link
Contributor Author

Updated the PR text and commit text to follow the 72 character boundary where possible.

Since I cherry picked this from a merged commit, the author was listed as both Keith and Myself. I changed the author to only myself.

@keithc-ca keithc-ca self-requested a review March 17, 2023 20:22
@keithc-ca
Copy link
Member

Jenkins test sanity alinux64,win32 jdk8

@keithc-ca keithc-ca merged commit e732eb1 into ibmruntimes:openj9 Mar 20, 2023
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.

2 participants