Merge with -stable
authorBryan O'Sullivan <bos@serpentine.com>
Thu, 06 Dec 2007 09:55:56 -0800
changeset 5615 ce383c80a177
parent 5613 2e76e5a23c2b (current diff)
parent 5614 5133e9f61700 (diff)
child 5616 88ca3e0fb6e5
Merge with -stable
--- a/mercurial/bdiff.c	Mon Dec 03 17:28:26 2007 -0600
+++ b/mercurial/bdiff.c	Thu Dec 06 09:55:56 2007 -0800
@@ -245,7 +245,7 @@
 
 	/* allocate and fill arrays */
 	t = equatelines(a, an, b, bn);
-	pos = (struct pos *)calloc(bn, sizeof(struct pos));
+	pos = (struct pos *)calloc((bn>0)?bn:1, sizeof(struct pos));
 	/* we can't have more matches than lines in the shorter file */
 	l.head = l.base = (struct hunk *)malloc(sizeof(struct hunk) *
 	                                        ((an<bn ? an:bn) + 1));