From 1a73d5a35c6da2b8e45df027b5313ac4e82a7390 Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Sun, 8 Mar 2026 09:02:39 +0100 Subject: [PATCH] [3.13] gh-145376: Fix refleak in `queuemodule.c` out-of-memory path (GH-145543) (#145621) gh-145376: Fix refleak in `queuemodule.c` out-of-memory path (GH-145543) (cherry picked from commit 0aeaaafac476119f242fe717ce60d2070172127b) Co-authored-by: Pieter Eendebak --- Modules/_queuemodule.c | 1 + 1 file changed, 1 insertion(+) diff --git a/Modules/_queuemodule.c b/Modules/_queuemodule.c index 5c995cf6833..9f1c9a1b0d4 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; } }