diffhelpers: verify hline was created before using it stable
authorAugie Fackler <augie@google.com>
Tue, 27 Jan 2015 10:07:04 -0500
branchstable
changeset 23959 c8e7fa41bfc5
parent 23958 df463ca0adef
child 23960 bca4b6f126f2
diffhelpers: verify hline was created before using it Found with cpychecker.
mercurial/diffhelpers.c
--- a/mercurial/diffhelpers.c	Sun Jan 25 22:55:10 2015 -0500
+++ b/mercurial/diffhelpers.c	Tue Jan 27 10:07:04 2015 -0500
@@ -34,6 +34,9 @@
 		sz -= 1;
 
 	hline = PyBytes_FromStringAndSize(l, sz-1);
+	if (!hline) {
+		return NULL;
+	}
 
 	if (c == ' ' || c == '+') {
 		PyObject *rline = PyBytes_FromStringAndSize(l + 1, sz - 2);
@@ -194,4 +197,3 @@
 	                                        NULL, NULL);
 }
 #endif
-