Patchwork [5,of,6,lazymanifest-errors] lazymanifest: check forgotten error in contains

login
register
mail settings
Submitter Augie Fackler
Date Dec. 31, 2015, 7:05 p.m.
Message ID <35ef7322aa717f45336e.1451588749@imladris.local>
Download mbox | patch
Permalink /patch/12453/
State Changes Requested
Delegated to: Yuya Nishihara
Headers show

Comments

Augie Fackler - Dec. 31, 2015, 7:05 p.m.
# HG changeset patch
# User Augie Fackler <raf@durin42.com>
# Date 1451587530 18000
#      Thu Dec 31 13:45:30 2015 -0500
# Node ID 35ef7322aa717f45336e4441c9458d9a08862370
# Parent  47c7daf84a37ad5ebdeb89861d4f25429a7e1d13
lazymanifest: check forgotten error in contains

Patch

diff --git a/mercurial/manifest.c b/mercurial/manifest.c
--- a/mercurial/manifest.c
+++ b/mercurial/manifest.c
@@ -585,6 +585,9 @@  static int lazymanifest_contains(lazyman
 		return 0;
 	}
 	needle.start = PyString_AsString(key);
+	if (!needle.start) {
+		return -1;
+	}
 	hit = bsearch(&needle, self->lines, self->numlines, sizeof(line),
 		      &linecmp);
 	if (!hit || hit->deleted) {