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:
parent
3c385cb49c
commit
b2ec22090d
1 changed files with 2 additions and 2 deletions
|
|
@ -133,8 +133,8 @@ namespace swig {
|
||||||
struct traits_as<Type, pointer_category> {
|
struct traits_as<Type, pointer_category> {
|
||||||
static Type as(PyObject *obj, bool throw_error) {
|
static Type as(PyObject *obj, bool throw_error) {
|
||||||
Type *v = 0;
|
Type *v = 0;
|
||||||
int res = (obj ? traits_asptr<Type>::asptr(obj, &v) : 0) && v;
|
int res = (obj ? traits_asptr<Type>::asptr(obj, &v) : 0);
|
||||||
if (res) {
|
if (res && v) {
|
||||||
if (res == SWIG_NEWOBJ) {
|
if (res == SWIG_NEWOBJ) {
|
||||||
Type r(*v);
|
Type r(*v);
|
||||||
delete v;
|
delete v;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue