[python/f16] fix memory leak in module _hashlib (patch 158, rhbz#836285)
Bohuslav Kabrda
bkabrda at fedoraproject.org
Tue Jul 24 11:29:45 UTC 2012
commit 99fbf23969bbe2fe0f8179174801875e900a3d61
Author: Bohuslav Kabrda <bkabrda at redhat.com>
Date: Tue Jul 24 08:51:00 2012 +0200
fix memory leak in module _hashlib (patch 158, rhbz#836285)
00158-fix-hashlib-leak.patch | 29 +++++++++++++++++++++++++++++
python.spec | 16 +++++++++++++++-
2 files changed, 44 insertions(+), 1 deletions(-)
---
diff --git a/00158-fix-hashlib-leak.patch b/00158-fix-hashlib-leak.patch
new file mode 100644
index 0000000..e8fcf1c
--- /dev/null
+++ b/00158-fix-hashlib-leak.patch
@@ -0,0 +1,29 @@
+diff --git a/Lib/test/test_hashlib.py b/Lib/test/test_hashlib.py
+--- a/Lib/test/test_hashlib.py
++++ b/Lib/test/test_hashlib.py
+@@ -108,12 +108,8 @@ class HashLibTestCase(unittest.TestCase)
+ _algo.islower()]))
+
+ def test_unknown_hash(self):
+- try:
+- hashlib.new('spam spam spam spam spam')
+- except ValueError:
+- pass
+- else:
+- self.assertTrue(0 == "hashlib didn't reject bogus hash name")
++ self.assertRaises(ValueError, hashlib.new, 'spam spam spam spam spam')
++ self.assertRaises(TypeError, hashlib.new, 1)
+
+ def test_get_builtin_constructor(self):
+ get_builtin_constructor = hashlib.__dict__[
+diff --git a/Modules/_hashopenssl.c b/Modules/_hashopenssl.c
+--- a/Modules/_hashopenssl.c
++++ b/Modules/_hashopenssl.c
+@@ -477,6 +477,7 @@ EVP_new(PyObject *self, PyObject *args,
+ }
+
+ if (!PyArg_Parse(name_obj, "s", &name)) {
++ PyBuffer_Release(&view);
+ PyErr_SetString(PyExc_TypeError, "name must be a string");
+ return NULL;
+ }
diff --git a/python.spec b/python.spec
index e4419e8..b139024 100644
--- a/python.spec
+++ b/python.spec
@@ -102,7 +102,7 @@ Summary: An interpreted, interactive, object-oriented programming language
Name: %{python}
# Remember to also rebase python-docs when changing this:
Version: 2.7.3
-Release: 3%{?dist}
+Release: 4%{?dist}
License: Python
Group: Development/Languages
Requires: %{python}-libs%{?_isa} = %{version}-%{release}
@@ -504,6 +504,15 @@ Patch130: python-2.7.2-add-extension-suffix-to-python-config.patch
# (rhbz#732998)
Patch131: python-2.7.2-disable-tests-in-test_io.patch
+# 00158
+# This patch fixes a memory leak in _hashlib module, as reported in
+# RHBZ #836285; upstream report http://bugs.python.org/issue15219.
+# The patch has been accepted upstream, so this should be commented out
+# when packaging next upstream release.
+# The fix for Fedora specific "implement_specific_EVP_new()" function
+# has been merged into patch 00146.
+Patch158: 00158-fix-hashlib-leak.patch
+
# This is the generated patch to "configure"; see the description of
# %{regenerate_autotooling_patch}
# above:
@@ -757,6 +766,8 @@ rm -r Modules/zlib || exit 1
%patch131 -p1
%endif
+%patch158 -p1
+
# This shouldn't be necesarry, but is right now (2.2a3)
find -name "*~" |xargs rm -f
@@ -1814,6 +1825,9 @@ rm -fr %{buildroot}
# ======================================================
%changelog
+* Tue Jul 17 2012 Bohuslav Kabrda <bkabrda at redhat.com> - 2.7.3-4
+- fix memory leak in module _hashlib (patch 158, rhbz#836285)
+
* Thu Apr 19 2012 David Malcolm <dmalcolm at redhat.com> - 2.7.3-3
- add explicit version requirements on expat to avoid linkage problems with
XML_SetHashSalt
More information about the scm-commits
mailing list