[Zope-Checkins] CVS: ZODB3/ZODB - TimeStamp.c:1.15.62.3
Tim Peters
tim.one@comcast.net
Thu, 19 Jun 2003 18:05:17 -0400
Update of /cvs-repository/ZODB3/ZODB
In directory cvs.zope.org:/tmp/cvs-serv20051/ZODB
Modified Files:
Tag: ZODB3-3_1-branch
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.
=== ZODB3/ZODB/TimeStamp.c 1.15.62.2 => 1.15.62.3 ===
--- ZODB3/ZODB/TimeStamp.c:1.15.62.2 Wed Nov 13 11:34:27 2002
+++ ZODB3/ZODB/TimeStamp.c Thu Jun 19 18:04:46 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));
}
}