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 leak in OpenSSL.crypto.dump_privatekey #496

Merged
merged 3 commits into from Jul 3, 2016

Conversation

Projects
None yet
3 participants
@hynek
Contributor

hynek commented Jul 3, 2016

Fixes #494

@hynek hynek added this to the 16.1.0 milestone Jul 3, 2016

@codecov-io

This comment has been minimized.

codecov-io commented Jul 3, 2016

Current coverage is 90.51%

Merging #496 into master will increase coverage by 0.09%

@@             master       #496   diff @@
==========================================
  Files             7          7          
  Lines          2067       2066     -1   
  Methods           0          0          
  Messages          0          0          
  Branches        343        342     -1   
==========================================
+ Hits           1869       1870     +1   
+ Misses          107        106     -1   
+ Partials         91         90     -1   

Powered by Codecov. Last updated by add5b07...a1273c0

@@ -1735,14 +1736,13 @@ def dump_privatekey(type, pkey, cipher=None, passphrase=None):
elif type == FILETYPE_TEXT:
rsa = _lib.EVP_PKEY_get1_RSA(pkey._pkey)
result_code = _lib.RSA_print(bio, rsa, 0)
# TODO RSA_free(rsa)?
_ffi.gc(rsa, _lib.RSA_free)

This comment has been minimized.

@alex

alex Jul 3, 2016

Member

This should be rsa = _ffi.gc(rsa, _lib.RSA_free) and it should be on the line right below rsa = _lib.EVP_PKEY...

@alex alex merged commit 11e43ad into pyca:master Jul 3, 2016

2 checks passed

codecov/patch 100% of diff hit (target 90.42%)
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@hynek hynek deleted the hynek:fix-dump-leak branch Jul 3, 2016

jsonn pushed a commit to jsonn/pkgsrc that referenced this pull request Jan 28, 2017

wiz
Updated py-OpenSSL to 16.2.0.
Add patch that makes tests on NetBSD progress further.
But then there's a segfault. See
pyca/pyopenssl#596

16.2.0 (2016-10-15)
-------------------

Changes:
^^^^^^^^

- Fixed compatibility errors with OpenSSL 1.1.0.
- Fixed an issue that caused failures with subinterpreters and embedded Pythons.
  `#552 <https://github.com/pyca/pyopenssl/pull/552>`_


16.1.0 (2016-08-26)
-------------------

Deprecations:
^^^^^^^^^^^^^

- Dropped support for OpenSSL 0.9.8.


Changes:
^^^^^^^^

- Fix memory leak in ``OpenSSL.crypto.dump_privatekey()`` with ``FILETYPE_TEXT``.
  `#496 <https://github.com/pyca/pyopenssl/pull/496>`_
- Enable use of CRL (and more) in verify context.
  `#483 <https://github.com/pyca/pyopenssl/pull/483>`_
- ``OpenSSL.crypto.PKey`` can now be constructed from ``cryptography`` objects and also exported as such.
  `#439 <https://github.com/pyca/pyopenssl/pull/439>`_
- Support newer versions of ``cryptography`` which use opaque structs for OpenSSL 1.1.0 compatibility.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment