You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Leak: _zstd.ZstdDecompressor() leaks a reference on invalid option key #148651
Modules/_zstd/decompressor.c is missing a Py_DECREF(value) before
the early return when PyLong_AsInt(key) fails. The identical code in Modules/_zstd/compressor.c has the fix.
Likely easy to miss other than very long running services that slowly
leak.
decompressor.c (buggy):
Py_INCREF(key); // line 109Py_INCREF(value); // line 110intkey_v=PyLong_AsInt(key); // line 111Py_DECREF(key); // line 112if (key_v==-1&&PyErr_Occurred()) {
return-1; // line 114 -- leaks value
}
compressor.c (correct):
Py_INCREF(key); // line 150Py_INCREF(value); // line 151intkey_v=PyLong_AsInt(key); // line 152Py_DECREF(key); // line 153if (key_v==-1&&PyErr_Occurred()) {
Py_DECREF(value); // line 158 -- present herereturn-1;
}
Activity
StanFromIreland commentedon Apr 16, 2026
The fix seems correct to me, go ahead! :-)
pythongh-148651: Fix Py_DECREF(value) leak in _zstd decompressor options
pythongh-148651: Fix Py_DECREF(value) leak in _zstd decompressor options
pythongh-148651: Fix Py_DECREF(value) leak in _zstd decompressor options
gh-148651: Fix refcount leak in _zstd decompressor options (#148657)
pythongh-148651: Fix refcount leak in _zstd decompressor options (pyt…
[3.14] gh-148651: Fix refcount leak in _zstd decompressor options (GH…
pythongh-148651: Fix refcount leak in _zstd decompressor options (pyt…