Commit 7513e635 authored by Barry Warsaw's avatar Barry Warsaw

initExtensionClass(): Be sure to decref the revision string and the

cobject (added to the module dict with the keys "__version__" and
"CAPI" respectively).  Fixes small leaks detected by Insure.
parent 57a374d9
...@@ -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: ExtensionClass.c,v 1.47 2001/10/04 14:09:38 matt Exp $ $Id: ExtensionClass.c,v 1.48 2001/11/08 16:57:54 bwarsaw Exp $
If you have questions regarding this software, If you have questions regarding this software,
contact: contact:
...@@ -54,7 +54,7 @@ static char ExtensionClass_module_documentation[] = ...@@ -54,7 +54,7 @@ static char ExtensionClass_module_documentation[] =
" - They provide access to unbound methods,\n" " - They provide access to unbound methods,\n"
" - They can be called to create instances.\n" " - They can be called to create instances.\n"
"\n" "\n"
"$Id: ExtensionClass.c,v 1.47 2001/10/04 14:09:38 matt Exp $\n" "$Id: ExtensionClass.c,v 1.48 2001/11/08 16:57:54 bwarsaw Exp $\n"
; ;
#include <stdio.h> #include <stdio.h>
...@@ -3533,8 +3533,8 @@ TrueExtensionClassCAPI = { ...@@ -3533,8 +3533,8 @@ TrueExtensionClassCAPI = {
void void
initExtensionClass(void) initExtensionClass(void)
{ {
PyObject *m, *d; PyObject *m, *d, *s;
char *rev="$Revision: 1.47 $"; char *rev="$Revision: 1.48 $";
PURE_MIXIN_CLASS(Base, "Minimalbase class for Extension Classes", NULL); PURE_MIXIN_CLASS(Base, "Minimalbase class for Extension Classes", NULL);
PMethodType.ob_type=&PyType_Type; PMethodType.ob_type=&PyType_Type;
...@@ -3549,8 +3549,9 @@ initExtensionClass(void) ...@@ -3549,8 +3549,9 @@ initExtensionClass(void)
(PyObject*)NULL,PYTHON_API_VERSION); (PyObject*)NULL,PYTHON_API_VERSION);
d = PyModule_GetDict(m); d = PyModule_GetDict(m);
PyDict_SetItemString(d,"__version__", s = PyString_FromStringAndSize(rev+11,strlen(rev+11)-2);
PyString_FromStringAndSize(rev+11,strlen(rev+11)-2)); PyDict_SetItemString(d,"__version__", s);
Py_XDECREF(s);
init_py_names(); init_py_names();
...@@ -3567,8 +3568,10 @@ initExtensionClass(void) ...@@ -3567,8 +3568,10 @@ initExtensionClass(void)
/* Export C attribute lookup API */ /* Export C attribute lookup API */
PyExtensionClassCAPI=&TrueExtensionClassCAPI; PyExtensionClassCAPI=&TrueExtensionClassCAPI;
PyDict_SetItemString(d, "CAPI",
PyCObject_FromVoidPtr(PyExtensionClassCAPI,NULL)); s = PyCObject_FromVoidPtr(PyExtensionClassCAPI, NULL);
PyDict_SetItemString(d, "CAPI", s);
Py_XDECREF(s);
CHECK_FOR_ERRORS("can't initialize module ExtensionClass"); CHECK_FOR_ERRORS("can't initialize module ExtensionClass");
} }
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