Message97849
Allright, I shall fix all this asap.
But it seems the C code for truncate is actually buggy in the current 2.6 _fileio.c, around line 680.
CF code below :
posobj = portable_lseek(fd, posobj, 0); -> don't we lose the reference to the old "posobj" there, doing a memory leak ?
if (PyErr_Occurred()) return NULL; -> same thing, we return Null without caring about the posobj reference which should be non-Null there ??
If I've understood a little reference counting, "portable_lseek" returns a reference that we own and must Py_DECREF, isn't that so ?
--------
if (posobj == Py_None || posobj == NULL) {
/* Get the current position. */
posobj = portable_lseek(fd, NULL, 1);
if (posobj == NULL)
return NULL;
}
else {
/* Move to the position to be truncated. */
posobj = portable_lseek(fd, posobj, 0);
}
#if defined(HAVE_LARGEFILE_SUPPORT)
pos = PyLong_AsLongLong(posobj);
#else
pos = PyLong_AsLong(posobj);
#endif
if (PyErr_Occurred())
return NULL;
------ |
|
Date |
User |
Action |
Args |
2010-01-15 21:21:29 | pakal | set | recipients:
+ pakal, pitrou |
2010-01-15 21:21:29 | pakal | set | messageid: <1263590489.29.0.622751301386.issue6939@psf.upfronthosting.co.za> |
2010-01-15 21:21:28 | pakal | link | issue6939 messages |
2010-01-15 21:21:27 | pakal | create | |
|