mirror of
https://github.com/python/cpython.git
synced 2025-11-12 07:02:33 +00:00
SF #1370197, memory leak - ast_error_finish (in error conditions).
This commit is contained in:
parent
af68c874a6
commit
8ad64aaacc
1 changed files with 6 additions and 2 deletions
|
|
@ -179,8 +179,10 @@ ast_error_finish(const char *filename)
|
||||||
return;
|
return;
|
||||||
Py_INCREF(errstr);
|
Py_INCREF(errstr);
|
||||||
lineno = PyInt_AsLong(PyTuple_GetItem(value, 1));
|
lineno = PyInt_AsLong(PyTuple_GetItem(value, 1));
|
||||||
if (lineno == -1)
|
if (lineno == -1) {
|
||||||
|
Py_DECREF(errstr);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
Py_DECREF(value);
|
Py_DECREF(value);
|
||||||
|
|
||||||
loc = PyErr_ProgramText(filename, lineno);
|
loc = PyErr_ProgramText(filename, lineno);
|
||||||
|
|
@ -190,8 +192,10 @@ ast_error_finish(const char *filename)
|
||||||
}
|
}
|
||||||
tmp = Py_BuildValue("(ziOO)", filename, lineno, Py_None, loc);
|
tmp = Py_BuildValue("(ziOO)", filename, lineno, Py_None, loc);
|
||||||
Py_DECREF(loc);
|
Py_DECREF(loc);
|
||||||
if (!tmp)
|
if (!tmp) {
|
||||||
|
Py_DECREF(errstr);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
value = Py_BuildValue("(OO)", errstr, tmp);
|
value = Py_BuildValue("(OO)", errstr, tmp);
|
||||||
Py_DECREF(errstr);
|
Py_DECREF(errstr);
|
||||||
Py_DECREF(tmp);
|
Py_DECREF(tmp);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue