mpatch: Fix for malloc corner case on AIX
authorMatt Mackall <mpm@selenic.com>
Thu, 21 Sep 2006 16:16:39 -0500
changeset 3138 cc856c4d91ca
parent 3137 2c472ab42b08
child 3139 1fd1cdcc4200
mpatch: Fix for malloc corner case on AIX
mercurial/mpatch.c
--- a/mercurial/mpatch.c	Thu Sep 21 16:15:39 2006 -0500
+++ b/mercurial/mpatch.c	Thu Sep 21 16:16:39 2006 -0500
@@ -62,6 +62,9 @@
 {
 	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);