mercurial/bdiff.c
changeset 5614 5133e9f61700
parent 5452 82b4ff3abbcd
child 5620 652f57de3ccf
--- a/mercurial/bdiff.c	Tue Dec 04 23:10:13 2007 +0100
+++ b/mercurial/bdiff.c	Tue Oct 23 10:39:24 2007 +0000
@@ -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));