changeset 26058:e7fe0a12376c

reachableroots: handle error of PyList_Append()
author Yuya Nishihara <yuya@tcha.org>
date Sat, 15 Aug 2015 19:38:03 +0900
parents 10917b062adf
children 8779ce81ea80
files mercurial/parsers.c
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/parsers.c	Fri Aug 07 22:39:47 2015 -0700
+++ b/mercurial/parsers.c	Sat Aug 15 19:38:03 2015 +0900
@@ -1203,8 +1203,10 @@
 			val = PyInt_FromLong(revnum);
 			if (val == NULL)
 				goto bail;
-			PyList_Append(reachable, val);
+			r = PyList_Append(reachable, val);
 			Py_DECREF(val);
+			if (r < 0)
+				goto bail;
 			if (includepath == 0)
 				continue;
 		}
@@ -1245,8 +1247,10 @@
 					val = PyInt_FromLong(i);
 					if (val == NULL)
 						goto bail;
-					PyList_Append(reachable, val);
+					r = PyList_Append(reachable, val);
 					Py_DECREF(val);
+					if (r < 0)
+						goto bail;
 				}
 			}
 		}