Commit db21f40c authored by Shane Hathaway's avatar Shane Hathaway

Plugged a memory leak that occurs when trying to "call" a wrapped object.

The memory leak only shows up if arguments are passed to the call.
(This should fix zope.org.  Yessss!)
parent 7ae1c480
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE. DAMAGE.
$Id: Acquisition.c,v 1.44 2000/09/29 17:21:27 tseaver Exp $ $Id: Acquisition.c,v 1.45 2000/10/05 23:25:01 shane Exp $
If you have questions regarding this software, If you have questions regarding this software,
contact: contact:
...@@ -117,7 +117,10 @@ CallMethodO(PyObject *self, PyObject *name, ...@@ -117,7 +117,10 @@ CallMethodO(PyObject *self, PyObject *name,
PyObject *args, PyObject *kw) PyObject *args, PyObject *kw)
{ {
if (! args && PyErr_Occurred()) return NULL; if (! args && PyErr_Occurred()) return NULL;
UNLESS(name=PyObject_GetAttr(self,name)) return NULL; UNLESS(name=PyObject_GetAttr(self,name)) {
if (args) Py_DECREF(args);
return NULL;
}
ASSIGN(name,PyEval_CallObjectWithKeywords(name,args,kw)); ASSIGN(name,PyEval_CallObjectWithKeywords(name,args,kw));
if (args) Py_DECREF(args); if (args) Py_DECREF(args);
return name; return name;
...@@ -1416,7 +1419,7 @@ void ...@@ -1416,7 +1419,7 @@ void
initAcquisition() initAcquisition()
{ {
PyObject *m, *d; PyObject *m, *d;
char *rev="$Revision: 1.44 $"; char *rev="$Revision: 1.45 $";
PURE_MIXIN_CLASS(Acquirer, PURE_MIXIN_CLASS(Acquirer,
"Base class for objects that implicitly" "Base class for objects that implicitly"
" acquire attributes from containers\n" " acquire attributes from containers\n"
...@@ -1435,7 +1438,7 @@ initAcquisition() ...@@ -1435,7 +1438,7 @@ initAcquisition()
/* Create the module and add the functions */ /* Create the module and add the functions */
m = Py_InitModule4("Acquisition", methods, m = Py_InitModule4("Acquisition", methods,
"Provide base classes for acquiring objects\n\n" "Provide base classes for acquiring objects\n\n"
"$Id: Acquisition.c,v 1.44 2000/09/29 17:21:27 tseaver Exp $\n", "$Id: Acquisition.c,v 1.45 2000/10/05 23:25:01 shane Exp $\n",
OBJECT(NULL),PYTHON_API_VERSION); OBJECT(NULL),PYTHON_API_VERSION);
d = PyModule_GetDict(m); d = PyModule_GetDict(m);
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE. DAMAGE.
$Id: Acquisition.c,v 1.44 2000/09/29 17:21:27 tseaver Exp $ $Id: Acquisition.c,v 1.45 2000/10/05 23:25:01 shane Exp $
If you have questions regarding this software, If you have questions regarding this software,
contact: contact:
...@@ -117,7 +117,10 @@ CallMethodO(PyObject *self, PyObject *name, ...@@ -117,7 +117,10 @@ CallMethodO(PyObject *self, PyObject *name,
PyObject *args, PyObject *kw) PyObject *args, PyObject *kw)
{ {
if (! args && PyErr_Occurred()) return NULL; if (! args && PyErr_Occurred()) return NULL;
UNLESS(name=PyObject_GetAttr(self,name)) return NULL; UNLESS(name=PyObject_GetAttr(self,name)) {
if (args) Py_DECREF(args);
return NULL;
}
ASSIGN(name,PyEval_CallObjectWithKeywords(name,args,kw)); ASSIGN(name,PyEval_CallObjectWithKeywords(name,args,kw));
if (args) Py_DECREF(args); if (args) Py_DECREF(args);
return name; return name;
...@@ -1416,7 +1419,7 @@ void ...@@ -1416,7 +1419,7 @@ void
initAcquisition() initAcquisition()
{ {
PyObject *m, *d; PyObject *m, *d;
char *rev="$Revision: 1.44 $"; char *rev="$Revision: 1.45 $";
PURE_MIXIN_CLASS(Acquirer, PURE_MIXIN_CLASS(Acquirer,
"Base class for objects that implicitly" "Base class for objects that implicitly"
" acquire attributes from containers\n" " acquire attributes from containers\n"
...@@ -1435,7 +1438,7 @@ initAcquisition() ...@@ -1435,7 +1438,7 @@ initAcquisition()
/* Create the module and add the functions */ /* Create the module and add the functions */
m = Py_InitModule4("Acquisition", methods, m = Py_InitModule4("Acquisition", methods,
"Provide base classes for acquiring objects\n\n" "Provide base classes for acquiring objects\n\n"
"$Id: Acquisition.c,v 1.44 2000/09/29 17:21:27 tseaver Exp $\n", "$Id: Acquisition.c,v 1.45 2000/10/05 23:25:01 shane Exp $\n",
OBJECT(NULL),PYTHON_API_VERSION); OBJECT(NULL),PYTHON_API_VERSION);
d = PyModule_GetDict(m); d = PyModule_GetDict(m);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment