From 7a54a653b718a70c96755f6fc39f01f5c582558a Mon Sep 17 00:00:00 2001 From: Pablo Galindo Salgado Date: Sat, 25 Jan 2025 16:54:20 +0000 Subject: [PATCH] gh-129271: Fix reference leak with unicode writer in fast path in the json module (#129272) --- Modules/_json.c | 1 + 1 file changed, 1 insertion(+) diff --git a/Modules/_json.c b/Modules/_json.c index 091bcbfdced..31a5e935e13 100644 --- a/Modules/_json.c +++ b/Modules/_json.c @@ -417,6 +417,7 @@ scanstring_unicode(PyObject *pystr, Py_ssize_t end, int strict, Py_ssize_t *next if (ret == NULL) { goto bail; } + PyUnicodeWriter_Discard(writer); *next_end_ptr = next + 1;; return ret; }