Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix memory leak in CALL (reference to args tuple not released)

  • Loading branch information...
commit 61a5f4f72b0e80436e927abf6c3a9fc5f1b763f0 1 parent c7f236c
@robince authored
Showing with 4 additions and 2 deletions.
  1. +4 −2 commands.c
View
6 commands.c
@@ -198,7 +198,7 @@ PYMEX(CALL, 2,3,
if (mxIsCell(prhs[1]))
args = mxCell_to_PyTuple(prhs[1]);
else
- args = unbox(prhs[1]);
+ args = unboxn(prhs[1]);
if (!args || !PyTuple_Check(args))
mexErrMsgIdAndTxt("python:NotTuple", "args must be a tuple");
PyObject *kwargs = NULL;
@@ -221,6 +221,7 @@ PYMEX(CALL, 2,3,
Py_XDECREF(krepr);
PyObject *result = PyObject_Call(callobj, args, kwargs);
plhs[0] = box(result);
+ Py_XDECREF(args);
})
#else
PYMEX(CALL, 2,3,
@@ -236,7 +237,7 @@ PYMEX(CALL, 2,3,
if (mxIsCell(prhs[1]))
args = mxCell_to_PyTuple(prhs[1]);
else
- args = unbox(prhs[1]);
+ args = unboxn(prhs[1]);
if (!args || !PyTuple_Check(args))
mexErrMsgIdAndTxt("python:NotTuple", "args must be a tuple");
PyObject *kwargs = NULL;
@@ -247,6 +248,7 @@ PYMEX(CALL, 2,3,
}
PyObject *result = PyObject_Call(callobj, args, kwargs);
plhs[0] = box(result);
+ Py_XDECREF(args);
})
#endif
Please sign in to comment.
Something went wrong with that request. Please try again.