From: Victor Stinner Date: Sat, 20 Aug 2016 01:05:13 +0000 (+0200) Subject: Fix reference leak in tb_printinternal() X-Git-Tag: v3.6.0b1~634 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a88b2f4e5e8e6b24df47176477cf2415e6a7e686;p=python Fix reference leak in tb_printinternal() Issue #26823. --- diff --git a/Python/traceback.c b/Python/traceback.c index 15cde444f4..b33156eaa7 100644 --- a/Python/traceback.c +++ b/Python/traceback.c @@ -435,6 +435,7 @@ tb_printinternal(PyTracebackObject *tb, PyObject *f, long limit) line = PyUnicode_FromFormat( " [Previous line repeated %d more times]\n", cnt-3); err = PyFile_WriteObject(line, f, Py_PRINT_RAW); + Py_DECREF(line); } last_file = tb->tb_frame->f_code->co_filename; last_line = tb->tb_lineno; @@ -456,6 +457,7 @@ tb_printinternal(PyTracebackObject *tb, PyObject *f, long limit) line = PyUnicode_FromFormat( " [Previous line repeated %d more times]\n", cnt-3); err = PyFile_WriteObject(line, f, Py_PRINT_RAW); + Py_DECREF(line); } return err; }