Merge branch 'ezralanglois-fix-memory-leak'
* ezralanglois-fix-memory-leak: Replicate Python memory leak fix in std::pair for Octave and Ruby Fix memory leak in std::pair Python binding Conflicts: CHANGES.current
This commit is contained in:
commit
6f0af6bec6
4 changed files with 30 additions and 10 deletions
|
|
@ -5,6 +5,10 @@ See the RELEASENOTES file for a summary of changes in each release.
|
||||||
Version 3.0.11 (in progress)
|
Version 3.0.11 (in progress)
|
||||||
============================
|
============================
|
||||||
|
|
||||||
|
2016-12-18: ezralanglois
|
||||||
|
[Python, Ruby, Octave] Memory leak fix on error in std::pair wrappers.
|
||||||
|
Issue https://github.com/swig/swig/pull/851
|
||||||
|
|
||||||
2016-12-18: wsfulton
|
2016-12-18: wsfulton
|
||||||
Zero initialize arrays when using %array_class and %array_functions.
|
Zero initialize arrays when using %array_class and %array_functions.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,12 +69,16 @@
|
||||||
value_type *vp = %new_instance(std::pair<T,U>);
|
value_type *vp = %new_instance(std::pair<T,U>);
|
||||||
T *pfirst = &(vp->first);
|
T *pfirst = &(vp->first);
|
||||||
int res1 = swig::asval(first, pfirst);
|
int res1 = swig::asval(first, pfirst);
|
||||||
if (!SWIG_IsOK(res1))
|
if (!SWIG_IsOK(res1)) {
|
||||||
|
%delete(vp);
|
||||||
return res1;
|
return res1;
|
||||||
|
}
|
||||||
U *psecond = &(vp->second);
|
U *psecond = &(vp->second);
|
||||||
int res2 = swig::asval(second, psecond);
|
int res2 = swig::asval(second, psecond);
|
||||||
if (!SWIG_IsOK(res2))
|
if (!SWIG_IsOK(res2)) {
|
||||||
|
%delete(vp);
|
||||||
return res2;
|
return res2;
|
||||||
|
}
|
||||||
*val = vp;
|
*val = vp;
|
||||||
return SWIG_AddNewMask(res1 > res2 ? res1 : res2);
|
return SWIG_AddNewMask(res1 > res2 ? res1 : res2);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -68,10 +68,16 @@
|
||||||
value_type *vp = %new_instance(std::pair<T,U>);
|
value_type *vp = %new_instance(std::pair<T,U>);
|
||||||
T *pfirst = &(vp->first);
|
T *pfirst = &(vp->first);
|
||||||
int res1 = swig::asval((PyObject*)first, pfirst);
|
int res1 = swig::asval((PyObject*)first, pfirst);
|
||||||
if (!SWIG_IsOK(res1)) return res1;
|
if (!SWIG_IsOK(res1)) {
|
||||||
|
%delete(vp);
|
||||||
|
return res1;
|
||||||
|
}
|
||||||
U *psecond = &(vp->second);
|
U *psecond = &(vp->second);
|
||||||
int res2 = swig::asval((PyObject*)second, psecond);
|
int res2 = swig::asval((PyObject*)second, psecond);
|
||||||
if (!SWIG_IsOK(res2)) return res2;
|
if (!SWIG_IsOK(res2)) {
|
||||||
|
%delete(vp);
|
||||||
|
return res2;
|
||||||
|
}
|
||||||
*val = vp;
|
*val = vp;
|
||||||
return SWIG_AddNewMask(res1 > res2 ? res1 : res2);
|
return SWIG_AddNewMask(res1 > res2 ? res1 : res2);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -63,10 +63,16 @@
|
||||||
value_type *vp = %new_instance(std::pair<T,U>);
|
value_type *vp = %new_instance(std::pair<T,U>);
|
||||||
T *pfirst = &(vp->first);
|
T *pfirst = &(vp->first);
|
||||||
int res1 = swig::asval((VALUE)first, pfirst);
|
int res1 = swig::asval((VALUE)first, pfirst);
|
||||||
if (!SWIG_IsOK(res1)) return res1;
|
if (!SWIG_IsOK(res1)) {
|
||||||
|
%delete(vp);
|
||||||
|
return res1;
|
||||||
|
}
|
||||||
U *psecond = &(vp->second);
|
U *psecond = &(vp->second);
|
||||||
int res2 = swig::asval((VALUE)second, psecond);
|
int res2 = swig::asval((VALUE)second, psecond);
|
||||||
if (!SWIG_IsOK(res2)) return res2;
|
if (!SWIG_IsOK(res2)) {
|
||||||
|
%delete(vp);
|
||||||
|
return res2;
|
||||||
|
}
|
||||||
*val = vp;
|
*val = vp;
|
||||||
return SWIG_AddNewMask(res1 > res2 ? res1 : res2);
|
return SWIG_AddNewMask(res1 > res2 ? res1 : res2);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue