From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Sun, 8 Mar 2026 08:02:51 +0000 (+0100) Subject: [3.14] gh-145376: Fix refleak in `queuemodule.c` out-of-memory path (GH-145543) ... X-Git-Tag: v3.14.4~192 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0e423f1c2612f43a18aed78e6439c57a9ec70b43;p=thirdparty%2FPython%2Fcpython.git [3.14] gh-145376: Fix refleak in `queuemodule.c` out-of-memory path (GH-145543) (#145622) gh-145376: Fix refleak in `queuemodule.c` out-of-memory path (GH-145543) (cherry picked from commit 0aeaaafac476119f242fe717ce60d2070172127b) Co-authored-by: Pieter Eendebak --- diff --git a/Modules/_queuemodule.c b/Modules/_queuemodule.c index 01235c77bd7d..9e3e5d251aa1 100644 --- a/Modules/_queuemodule.c +++ b/Modules/_queuemodule.c @@ -165,6 +165,7 @@ RingBuf_Put(RingBuf *buf, PyObject *item) // Buffer is full, grow it. if (resize_ringbuf(buf, buf->items_cap * 2) < 0) { PyErr_NoMemory(); + Py_DECREF(item); return -1; } }