[Python-bugs-list] Invalid use of PyMem_DEL (PR#295)
niels@endea.demon.nl
niels@endea.demon.nl
Thu, 13 Apr 2000 14:16:27 -0400 (EDT)
Full_Name: Niels Diepeveen
Version: 1.5.2 and 1.6.a2
OS: Win95 and Linux
Submission from: endea.demon.nl (195.173.229.149)
Hi,
I ran into a bug while running a regrtest on 1.6a2 with debugging on.
This produced a reference checking problem, which I now see is the same as
reported in #113. I have tracked this down to the use of PyMem_DEL on an
object created by PyObject_NEW in PyPcre_compile. When the compile fails,
the new object is deallocated, but not removed from the reference chain.
This also happens in 1.5.2.
With a little grepping, I tracked down a few instances of this
problem:
pcremodule.c:PyPcre_compile
unicodeobject.c:_PyUnicode_New
socketmodule.c:newSSLObject
threadmodule.c:newlockobject
In each case a partially constructed, but already registered object is
simply deleted without calling _Py_ForgetReference.