]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-129271: Fix reference leak with unicode writer in fast path in the json module...
authorPablo Galindo Salgado <Pablogsal@gmail.com>
Sat, 25 Jan 2025 16:54:20 +0000 (16:54 +0000)
committerGitHub <noreply@github.com>
Sat, 25 Jan 2025 16:54:20 +0000 (17:54 +0100)
Modules/_json.c

index 091bcbfdced42b6734fe91e18d015d833a0c58df..31a5e935e13ad94c40bfa43f96ad58507ddce576 100644 (file)
@@ -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;
             }