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:
William S Fulton 2016-12-18 20:02:40 +00:00
commit 6f0af6bec6
4 changed files with 30 additions and 10 deletions

View file

@ -31,7 +31,7 @@
int res2 = swig::asval((PyObject*)second, psecond);
if (!SWIG_IsOK(res2)) return res2;
return res1 > res2 ? res1 : res2;
}
}
}
static int asval(PyObject *obj, std::pair<T,U> *val) {
@ -68,10 +68,16 @@
value_type *vp = %new_instance(std::pair<T,U>);
T *pfirst = &(vp->first);
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);
int res2 = swig::asval((PyObject*)second, psecond);
if (!SWIG_IsOK(res2)) return res2;
if (!SWIG_IsOK(res2)) {
%delete(vp);
return res2;
}
*val = vp;
return SWIG_AddNewMask(res1 > res2 ? res1 : res2);
} else {
@ -82,7 +88,7 @@
int res2 = swig::asval((PyObject*)second, psecond);
if (!SWIG_IsOK(res2)) return res2;
return res1 > res2 ? res1 : res2;
}
}
}
static int asptr(PyObject *obj, std::pair<T,U> **val) {