mirror of
https://github.com/boostorg/python.git
synced 2026-01-24 18:12:43 +00:00
Leak bug fixed thanks to gideon may <gideon-at-computer.org> for
reporting it. [SVN r18671]
This commit is contained in:
@@ -99,11 +99,12 @@ PyObject* make_nurse_and_patient(PyObject* nurse, PyObject* patient)
|
||||
// We're going to leak this reference, but don't worry; the
|
||||
// life_support system decrements it when the nurse dies.
|
||||
PyObject* weakref = PyWeakref_NewRef(nurse, (PyObject*)system);
|
||||
|
||||
// weakref has either taken ownership, or we have to release it
|
||||
// anyway
|
||||
Py_DECREF(system);
|
||||
if (!weakref)
|
||||
{
|
||||
Py_XDECREF(system);
|
||||
return 0;
|
||||
}
|
||||
|
||||
system->patient = patient;
|
||||
Py_XINCREF(patient); // hang on to the patient until death
|
||||
|
||||
Reference in New Issue
Block a user