mirror of
https://github.com/python/cpython.git
synced 2026-04-20 10:51:00 +00:00
gh-148651: Fix refcount leak in _zstd decompressor options (#148657)
The option parsing in Modules/_zstd/decompressor.c had a missing Py_DECREF(value) before the early return -1 when PyLong_AsInt(key) fails. The identical code in Modules/_zstd/compressor.c line 158 has the fix.
This commit is contained in:
parent
a86234ea85
commit
446edda209
2 changed files with 3 additions and 0 deletions
|
|
@ -0,0 +1,2 @@
|
|||
Fix reference leak in :class:`compression.zstd.ZstdDecompressor` when an
|
||||
invalid option key is passed.
|
||||
|
|
@ -111,6 +111,7 @@ _zstd_set_d_parameters(ZstdDecompressor *self, PyObject *options)
|
|||
int key_v = PyLong_AsInt(key);
|
||||
Py_DECREF(key);
|
||||
if (key_v == -1 && PyErr_Occurred()) {
|
||||
Py_DECREF(value);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue