mirror of
https://github.com/python/cpython.git
synced 2026-06-04 16:50:51 +00:00
gh-149921: Fix reference leaks in _interpchannels and _interpqueues modules (#149922)
This commit is contained in:
parent
e62a61177f
commit
acefff95ea
3 changed files with 5 additions and 2 deletions
|
|
@ -0,0 +1,2 @@
|
|||
Fix reference leaks in error paths of the :mod:`!_interpchannels` and
|
||||
:mod:`!_interpqueues` extension modules.
|
||||
|
|
@ -2586,6 +2586,7 @@ static PyObject *
|
|||
_channelid_from_xid(_PyXIData_t *data)
|
||||
{
|
||||
struct _channelid_xid *xid = (struct _channelid_xid *)_PyXIData_DATA(data);
|
||||
PyObject *cidobj = NULL;
|
||||
|
||||
// It might not be imported yet, so we can't use _get_current_module().
|
||||
PyObject *mod = PyImport_ImportModule(MODULE_NAME_STR);
|
||||
|
|
@ -2595,11 +2596,10 @@ _channelid_from_xid(_PyXIData_t *data)
|
|||
assert(mod != Py_None);
|
||||
module_state *state = get_module_state(mod);
|
||||
if (state == NULL) {
|
||||
return NULL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
// Note that we do not preserve the "resolve" flag.
|
||||
PyObject *cidobj = NULL;
|
||||
int err = newchannelid(state->ChannelIDType, xid->cid, xid->end,
|
||||
_global_channels(), 0, 0,
|
||||
(channelid **)&cidobj);
|
||||
|
|
|
|||
|
|
@ -1363,6 +1363,7 @@ _queueobj_from_xid(_PyXIData_t *data)
|
|||
if (mod == NULL) {
|
||||
mod = PyImport_ImportModule(MODULE_NAME_STR);
|
||||
if (mod == NULL) {
|
||||
Py_DECREF(qidobj);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue