[Python-checkins] commit of r41641 - python/trunk/Python/ast.c

neal.norwitz python-checkins at python.org
Sun Dec 11 21:08:33 CET 2005


Author: neal.norwitz
Date: Sun Dec 11 21:08:33 2005
New Revision: 41641
Modified:
 python/trunk/Python/ast.c
Log:
SF #1370197, memory leak - ast_error_finish (in error conditions).
Modified: python/trunk/Python/ast.c
==============================================================================
--- python/trunk/Python/ast.c	(original)
+++ python/trunk/Python/ast.c	Sun Dec 11 21:08:33 2005
@@ -179,8 +179,10 @@
 	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 @@
 }
 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);


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /