[Zodb-checkins] CVS: StandaloneZODB/BTrees - BTreeModuleTemplate.c:1.14

Barry Warsaw barry@wooz.org
Thu, 8 Nov 2001 11:52:02 -0500


Update of /cvs-repository/StandaloneZODB/BTrees
In directory cvs.zope.org:/tmp/cvs-serv579/BTrees

Modified Files:
	BTreeModuleTemplate.c 
Log Message:
INITMODULE(): Be sure to decref the $Revision$ string added to the
module dictionary under the "__version__" key.  Plugs a small memory
leak caught by Insure.


=== StandaloneZODB/BTrees/BTreeModuleTemplate.c 1.13 => 1.14 ===
 INITMODULE (void)
 {
-  PyObject *m, *d, *c;
+  PyObject *m, *d, *c, *s;
 
   UNLESS (sort_str=PyString_FromString("sort")) return;
   UNLESS (reverse_str=PyString_FromString("reverse")) return;
@@ -426,8 +426,9 @@
   /* Add some symbolic constants to the module */
   d = PyModule_GetDict(m);
 
-  PyDict_SetItemString(d, "__version__",
-		       PyString_FromString("$Revision$"));
+  s = PyString_FromString("$Revision$");
+  PyDict_SetItemString(d, "__version__", s);
+  Py_XDECREF(s);
 
   PyExtensionClass_Export(d,MOD_NAME_PREFIX "Bucket", BucketType);
   PyExtensionClass_Export(d,MOD_NAME_PREFIX "BTree", BTreeType);