mercurial/mpatch.c
changeset 282 97d83e7fbf2f
parent 128 d6afb6dbf9f2
child 384 a29decbf7475
--- a/mercurial/mpatch.c
+++ b/mercurial/mpatch.c
@@ -44,9 +44,10 @@ static struct flist *lalloc(int size)
 	a = malloc(sizeof(struct flist));
 	if (a) {
 		a->base = malloc(sizeof(struct frag) * size);
-		if (!a->base)
+		if (!a->base) {
 			free(a);
-		else
+			a = NULL;
+		} else
 			a->head = a->tail = a->base;
 	}
 	return a;