diff options
Diffstat (limited to 'gdb/python')
-rw-r--r-- | gdb/python/py-inferior.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c index 3d2cb1d..f6a24a0 100644 --- a/gdb/python/py-inferior.c +++ b/gdb/python/py-inferior.c @@ -223,11 +223,14 @@ inferior_to_inferior_object (struct inferior *inferior) inf_obj->threads = NULL; inf_obj->nthreads = 0; + /* PyObject_New initializes the new object with a refcount of 1. This + counts for the reference we are keeping in the inferior data. */ set_inferior_data (inferior, infpy_inf_data_key, inf_obj); } - else - Py_INCREF ((PyObject *)inf_obj); + + /* We are returning a new reference. */ + Py_INCREF ((PyObject *)inf_obj); return (PyObject *) inf_obj; } |