2
0
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:
Dave Abrahams
2003-06-04 20:47:39 +00:00
parent 1ae85d0e39
commit 5da3e1deea

View File

@@ -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