Mercurial > hg
changeset 5571:f84bb2e1cc3a
fix calloc(0, ...) issue
author | Jim Hague <jim.hague@acm.org> |
---|---|
date | Tue, 23 Oct 2007 10:39:24 +0000 |
parents | 78a6b985882f |
children | 9c7f543405c1 |
files | mercurial/bdiff.c |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/bdiff.c Sun Dec 02 15:15:49 2007 -0600 +++ 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 ? 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));