]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] gh-145376: Fix refleak in `queuemodule.c` out-of-memory path (GH-145543) ...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 8 Mar 2026 08:02:51 +0000 (09:02 +0100)
committerGitHub <noreply@github.com>
Sun, 8 Mar 2026 08:02:51 +0000 (13:32 +0530)
gh-145376: Fix refleak in `queuemodule.c` out-of-memory path (GH-145543)
(cherry picked from commit 0aeaaafac476119f242fe717ce60d2070172127b)

Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Modules/_queuemodule.c

index 01235c77bd7db8ea61e3434e20b506c7ce0ae488..9e3e5d251aa1b805ba00e685199a99072f656b63 100644 (file)
@@ -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;
         }
     }