# HG changeset patch # User Jim Hague # Date 2007-10-23 10:39:24 # Node ID f84bb2e1cc3a37070ffbb6852af329e068d91bdb # Parent 78a6b985882f4221f9a7a05744bbdb95eb5aeaec fix calloc(0, ...) issue diff --git a/mercurial/bdiff.c b/mercurial/bdiff.c --- a/mercurial/bdiff.c +++ b/mercurial/bdiff.c @@ -245,7 +245,7 @@ static struct hunklist diff(struct line /* allocate and fill arrays */ t = equatelines(a, an, b, bn); - pos = (struct pos *)calloc(bn, sizeof(struct pos)); + pos = (struct pos *)calloc(bn ? 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