Set correct exception for another possible malloc error in mpatch.c
authorThomas Arendsen Hein <thomas@intevation.de>
Wed, 05 Apr 2006 15:39:48 +0200
changeset 2048 8f9660c568b8
parent 2047 ebf1ecb5f4e8
child 2049 f70952384ae7
Set correct exception for another possible malloc error in mpatch.c
mercurial/mpatch.c
--- a/mercurial/mpatch.c	Tue Apr 04 16:35:20 2006 -0700
+++ b/mercurial/mpatch.c	Wed Apr 05 15:39:48 2006 +0200
@@ -61,12 +61,12 @@
 	a = (struct flist *)malloc(sizeof(struct flist));
 	if (a) {
 		a->base = (struct frag *)malloc(sizeof(struct frag) * size);
-		if (!a->base) {
-			free(a);
-			a = NULL;
-		} else
+		if (a->base) {
 			a->head = a->tail = a->base;
-		return a;
+			return a;
+		}
+		free(a);
+		a = NULL;
 	}
 	if (!PyErr_Occurred())
 		PyErr_NoMemory();