]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] 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:39 +0000 (09:02 +0100)
committerGitHub <noreply@github.com>
Sun, 8 Mar 2026 08:02:39 +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 5c995cf68334e62536e2ad0f11aba316fc4ee90e..9f1c9a1b0d4283fe3e300a5673b40e56054859b2 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;
         }
     }