Skip to content

bpo-29738: Fix memory leak in _get_crl_dp#526

Merged
Mariatta merged 2 commits into
python:masterfrom
olivielpeau:fix-issue-29738
Apr 15, 2017
Merged

bpo-29738: Fix memory leak in _get_crl_dp#526
Mariatta merged 2 commits into
python:masterfrom
olivielpeau:fix-issue-29738

Conversation

@olivielpeau

Copy link
Copy Markdown
Contributor
  • Remove conditional on free of dps, since dps is now allocated for
    all versions of OpenSSL
  • Use sk_DIST_POINT_pop_free instead of sk_DIST_POINT_free since
    the latter doesn't free the individual elements of the stack
  • Remove call to x509_check_ca since it was only used to cache
    the crldp field of the certificate

* Remove conditional on free of `dps`, since `dps` is now allocated for
all versions of OpenSSL
* Use `sk_DIST_POINT_pop_free` instead of `sk_DIST_POINT_free` since
the latter doesn't free the individual elements of the stack
* Remove call to `x509_check_ca` since it was only used to cache
the `crldp` field of the certificate
@the-knights-who-say-ni

Copy link
Copy Markdown

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Unfortunately our records indicate you have not signed the CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow these steps to rectify the issue:

  1. Sign the PSF contributor agreement. The "bugs.python.org username" requested by the form is the "Login name" field in "Your Details" at b.p.o
  2. Wait at least one US business day and then check the "Contributor form received entry under "Your Details" on bugs.python.org to see if your account has been marked as having signed the CLA (the delay is due to a person having to manually check your signed CLA)
  3. Reply here saying you have completed the above steps

Thanks again to your contribution and we look forward to looking at it!

@mention-bot

Copy link
Copy Markdown

@olivielpeau, thanks for your PR! By analyzing the history of the files in this pull request, we identified @tiran, @Yhg1s, @loewis, @serhiy-storchaka and @Haypo to be potential reviewers.

@olivielpeau

Copy link
Copy Markdown
Contributor Author

@the-knights-who-say-ni : CLA signed

@alex alex left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks correct to me.

I can't remember the rules for merging and backports, so I'm hoping another core dev will actually land :-)

@tiran tiran left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

CRL_DIST_POINTS_free is available in all supported versions of OpenSSL (recent 0.9.8+) and LibreSSL.

Comment thread Modules/_ssl.c Outdated
#if OPENSSL_VERSION_NUMBER < 0x10001000L
sk_DIST_POINT_free(dps);
#endif
sk_DIST_POINT_pop_free(dps, DIST_POINT_free);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

CRL_DIST_POINTS_free(dps);

Addresses PR review.

CRL_DIST_POINTS_free is available in all supported versions of OpenSSL
(recent 0.9.8+) and LibreSSL.
@olivielpeau

Copy link
Copy Markdown
Contributor Author

@tiran Thanks for the review! I've addressed your comment, let me know if this looks good now

@Mariatta Mariatta merged commit 2849cc3 into python:master Apr 15, 2017
Mariatta pushed a commit to Mariatta/cpython that referenced this pull request Apr 15, 2017
* Remove conditional on free of `dps`, since `dps` is now allocated for
all versions of OpenSSL
* Remove call to `x509_check_ca` since it was only used to cache
the `crldp` field of the certificate
CRL_DIST_POINTS_free is available in all supported versions of OpenSSL
(recent 0.9.8+) and LibreSSL.
(cherry picked from commit 2849cc3)
Mariatta pushed a commit to Mariatta/cpython that referenced this pull request Apr 15, 2017
* Remove conditional on free of `dps`, since `dps` is now allocated for
all versions of OpenSSL
* Remove call to `x509_check_ca` since it was only used to cache
the `crldp` field of the certificate
CRL_DIST_POINTS_free is available in all supported versions of OpenSSL
(recent 0.9.8+) and LibreSSL.
(cherry picked from commit 2849cc3)
Mariatta pushed a commit to Mariatta/cpython that referenced this pull request Apr 15, 2017
* Remove conditional on free of `dps`, since `dps` is now allocated for
all versions of OpenSSL
* Remove call to `x509_check_ca` since it was only used to cache
the `crldp` field of the certificate
CRL_DIST_POINTS_free is available in all supported versions of OpenSSL
(recent 0.9.8+) and LibreSSL.
(cherry picked from commit 2849cc3)
Mariatta added a commit that referenced this pull request Apr 15, 2017
* Remove conditional on free of `dps`, since `dps` is now allocated for
all versions of OpenSSL
* Remove call to `x509_check_ca` since it was only used to cache
the `crldp` field of the certificate
CRL_DIST_POINTS_free is available in all supported versions of OpenSSL
(recent 0.9.8+) and LibreSSL.
(cherry picked from commit 2849cc3)
Mariatta added a commit that referenced this pull request Apr 15, 2017
* Remove conditional on free of `dps`, since `dps` is now allocated for
all versions of OpenSSL
* Remove call to `x509_check_ca` since it was only used to cache
the `crldp` field of the certificate
CRL_DIST_POINTS_free is available in all supported versions of OpenSSL
(recent 0.9.8+) and LibreSSL.
(cherry picked from commit 2849cc3)
Mariatta added a commit that referenced this pull request Apr 15, 2017
* Remove conditional on free of `dps`, since `dps` is now allocated for
all versions of OpenSSL
* Remove call to `x509_check_ca` since it was only used to cache
the `crldp` field of the certificate
CRL_DIST_POINTS_free is available in all supported versions of OpenSSL
(recent 0.9.8+) and LibreSSL.
(cherry picked from commit 2849cc3)
@Mariatta

Copy link
Copy Markdown
Member

Thanks @olivielpeau and congrats for your first contribution to CPython 🎉

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.

6 participants