python cffi package contains lib_obj module and there is a
mem leak introduced while converting pointers and func pointers
into a python object.
Change-Id: Ic4f61ddf20c5053c122761497323e6aa59af8781
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/5355
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Anish Swaminathan <anishs@vmware.com>
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,18 @@ |
| 0 |
+Based on the discussion at |
|
| 1 |
+https://bitbucket.org/cffi/cffi/issues/366/fix-known-small-but-needless-leak |
|
| 2 |
+ |
|
| 3 |
+--- cffi-1.10.0/c/lib_obj.c 2017-03-21 16:11:29.000000000 +0530 |
|
| 4 |
+@@ -328,6 +328,12 @@ static PyObject *lib_build_and_cache_att |
|
| 5 |
+ } |
|
| 6 |
+ x = convert_to_object(data, ct); |
|
| 7 |
+ Py_DECREF(ct); |
|
| 8 |
++ |
|
| 9 |
++ if (!(ct->ct_flags & CT_PRIMITIVE_ANY)) {
|
|
| 10 |
++ if (ct->ct_flags & (CT_POINTER|CT_FUNCTIONPTR)) {
|
|
| 11 |
++ PyMem_Free(data); |
|
| 12 |
++ } |
|
| 13 |
++ } |
|
| 14 |
+ break; |
|
| 15 |
+ } |
|
| 16 |
+ |
| ... | ... |
@@ -3,7 +3,7 @@ |
| 3 | 3 |
Summary: Interface for Python to call C code |
| 4 | 4 |
Name: python-cffi |
| 5 | 5 |
Version: 1.9.1 |
| 6 |
-Release: 2%{?dist}
|
|
| 6 |
+Release: 3%{?dist}
|
|
| 7 | 7 |
Url: https://pypi.python.org/pypi/cffi |
| 8 | 8 |
License: MIT |
| 9 | 9 |
Group: Development/Languages/Python |
| ... | ... |
@@ -12,6 +12,7 @@ Distribution: Photon |
| 12 | 12 |
Source0: https://pypi.python.org/packages/source/c/cffi/cffi-%{version}.tar.gz
|
| 13 | 13 |
%define sha1 cffi=16265a4b305d433fb9089b19278502e904b0cb43 |
| 14 | 14 |
|
| 15 |
+Patch0: python-cffi-fix-mem-leak.patch |
|
| 15 | 16 |
BuildRequires: python2 |
| 16 | 17 |
BuildRequires: python2-libs |
| 17 | 18 |
BuildRequires: python2-devel |
| ... | ... |
@@ -42,6 +43,7 @@ Python 3 version. |
| 42 | 42 |
|
| 43 | 43 |
%prep |
| 44 | 44 |
%setup -q -n cffi-%{version}
|
| 45 |
+%patch0 -p1 |
|
| 45 | 46 |
|
| 46 | 47 |
%build |
| 47 | 48 |
python setup.py build |
| ... | ... |
@@ -60,6 +62,8 @@ python3 setup.py install --prefix=%{_prefix} --root=%{buildroot}
|
| 60 | 60 |
%{python3_sitelib}/*
|
| 61 | 61 |
|
| 62 | 62 |
%changelog |
| 63 |
+* Fri Jul 13 2018 Srinidhi Rao <srinidhir@vmware.com> 1.9.1-3 |
|
| 64 |
+- Fix memory leak in python-cffi libobj module |
|
| 63 | 65 |
* Mon Dec 04 2017 Kumar Kaushik <kaushikk@vmware.com> 1.9.1-2 |
| 64 | 66 |
- Release bump to use python 3.5.4. |
| 65 | 67 |
* Mon Mar 13 2017 Xiaolin Li <xiaolinl@vmware.com> 1.9.1-1 |