changeset 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 2c472ab42b08
children 1fd1cdcc4200
files mercurial/mpatch.c
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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);