diff mercurial/mpatch.c @ 3138:cc856c4d91ca

mpatch: Fix for malloc corner case on AIX
author Matt Mackall <mpm@selenic.com>
date Thu, 21 Sep 2006 16:16:39 -0500
parents 345bac2bc4ec
children 95ffa36d1d2a 11dc22eb8e8d
line wrap: on
line diff
--- a/mercurial/mpatch.c
+++ b/mercurial/mpatch.c
@@ -62,6 +62,9 @@ static struct flist *lalloc(int size)
 {
 	struct flist *a = NULL;
 
+	if (size < 1)
+		size = 1;
+
 	a = (struct flist *)malloc(sizeof(struct flist));
 	if (a) {
 		a->base = (struct frag *)malloc(sizeof(struct frag) * size);