mirror of
https://github.com/JakeHillion/drgn.git
synced 2024-12-22 17:23:06 +00:00
python: fix FaultError reference leak
PyErr_SetObject() takes a reference on the exception value, so we need
to drop the reference we got when we created the value. Issue #196 ran
into this by reading tons of unmapped addresses.
Fixes: 80fef04c70
("Add address attribute to FaultError exception")
Signed-off-by: Omar Sandoval <osandov@osandov.com>
This commit is contained in:
parent
79ea6589c2
commit
6c90315f6f
@ -161,8 +161,10 @@ DRGNPY_PUBLIC void *set_drgn_error(struct drgn_error *err)
|
||||
|
||||
exc = PyObject_CallFunction((PyObject *)&FaultError_type, "sK",
|
||||
err->message, err->address);
|
||||
if (exc)
|
||||
if (exc) {
|
||||
PyErr_SetObject((PyObject *)&FaultError_type, exc);
|
||||
Py_DECREF(exc);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DRGN_ERROR_TYPE:
|
||||
|
Loading…
Reference in New Issue
Block a user