https://github.com/python/cpython/commit/0e423f1c2612f43a18aed78e6439c57a9ec70b43
commit: 0e423f1c2612f43a18aed78e6439c57a9ec70b43
branch: 3.14
author: Miss Islington (bot) <[email protected]>
committer: kumaraditya303 <[email protected]>
date: 2026-03-08T13:32:51+05:30
summary:

[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 <[email protected]>

files:
M Modules/_queuemodule.c

diff --git a/Modules/_queuemodule.c b/Modules/_queuemodule.c
index 01235c77bd7db8..9e3e5d251aa1b8 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;
         }
     }

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to