]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-145376: Fix refleak in `queuemodule.c` out-of-memory path (#145543)
authorPieter Eendebak <pieter.eendebak@gmail.com>
Sat, 7 Mar 2026 09:05:08 +0000 (10:05 +0100)
committerGitHub <noreply@github.com>
Sat, 7 Mar 2026 09:05:08 +0000 (14:35 +0530)
Modules/_queuemodule.c

index a45959346bc1f20c0459826f578c3c26efda9289..f2246dd36cf110c8d7de786281be5bea25ba7617 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;
         }
     }