[Zodb-checkins] CVS: Zope/lib/python/ZODB - TimeStamp.c:1.18
Tim Peters
tim.one at comcast.net
Thu Jun 19 18:50:44 EDT 2003
Update of /cvs-repository/Zope/lib/python/ZODB
In directory cvs.zope.org:/tmp/cvs-serv17308/lib/python/ZODB
Modified Files:
TimeStamp.c
Log Message:
TimeStamp_laterThan(): This leaked a Python string object whenever it
had to create a new timestamp. Fixed.
check2ZODBThreads(), check7ZODBThreads(): Close the database when
these tests end. Else they leak bigtime, obscuring searches for real
leaks.
=== Zope/lib/python/ZODB/TimeStamp.c 1.17 => 1.18 ===
--- Zope/lib/python/ZODB/TimeStamp.c:1.17 Wed Nov 13 11:32:03 2002
+++ Zope/lib/python/ZODB/TimeStamp.c Thu Jun 19 17:50:13 2003
@@ -222,7 +222,7 @@
TimeStamp_laterThan(TimeStamp *self, PyObject *args)
{
TimeStamp *o=NULL;
- unsigned char *s;
+ unsigned char s[8];
PyObject *a;
int i;
@@ -236,9 +236,7 @@
self=o;
- UNLESS(a=PyString_FromStringAndSize((char *) self->data, 8)) return NULL;
- s=(unsigned char *)PyString_AsString(a);
-
+ memcpy(s, self->data, 8);
for (i=7; i > 3; i--)
{
if (s[i] == 255)
@@ -246,7 +244,8 @@
else
{
s[i]++;
- return PyObject_CallFunction(OBJECT(self->ob_type), "O", a);
+ return PyObject_CallFunction(OBJECT(self->ob_type), "N",
+ PyString_FromStringAndSize(s, 8));
}
}
More information about the Zodb-checkins
mailing list