summaryrefslogtreecommitdiffstats
path: root/Python/ast.c
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2005-12-11 20:08:33 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2005-12-11 20:08:33 (GMT)
commit8ad64aaacc22d68d6d93c3c12f7e67e9962de09b (patch)
tree629d128bb2c042f71e881cad102d2c9ddd97fa3a /Python/ast.c
parentaf68c874a6803b4e90b616077a602c0593719a1d (diff)
downloadcpython-8ad64aaacc22d68d6d93c3c12f7e67e9962de09b.zip
cpython-8ad64aaacc22d68d6d93c3c12f7e67e9962de09b.tar.gz
cpython-8ad64aaacc22d68d6d93c3c12f7e67e9962de09b.tar.bz2
SF #1370197, memory leak - ast_error_finish (in error conditions).
Diffstat (limited to 'Python/ast.c')
-rw-r--r--Python/ast.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/Python/ast.c b/Python/ast.c
index 2250683..89ec217 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -179,8 +179,10 @@ ast_error_finish(const char *filename)
return;
Py_INCREF(errstr);
lineno = PyInt_AsLong(PyTuple_GetItem(value, 1));
- if (lineno == -1)
+ if (lineno == -1) {
+ Py_DECREF(errstr);
return;
+ }
Py_DECREF(value);
loc = PyErr_ProgramText(filename, lineno);
@@ -190,8 +192,10 @@ ast_error_finish(const char *filename)
}
tmp = Py_BuildValue("(ziOO)", filename, lineno, Py_None, loc);
Py_DECREF(loc);
- if (!tmp)
+ if (!tmp) {
+ Py_DECREF(errstr);
return;
+ }
value = Py_BuildValue("(OO)", errstr, tmp);
Py_DECREF(errstr);
Py_DECREF(tmp);