fix memory leak reported by Bo Peng

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7026 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2005-03-06 06:41:43 +00:00
commit b2ec22090d

View file

@ -133,8 +133,8 @@ namespace swig {
struct traits_as<Type, pointer_category> {
static Type as(PyObject *obj, bool throw_error) {
Type *v = 0;
int res = (obj ? traits_asptr<Type>::asptr(obj, &v) : 0) && v;
if (res) {
int res = (obj ? traits_asptr<Type>::asptr(obj, &v) : 0);
if (res && v) {
if (res == SWIG_NEWOBJ) {
Type r(*v);
delete v;