changeset 2048:8f9660c568b8

Set correct exception for another possible malloc error in mpatch.c
author Thomas Arendsen Hein <thomas@intevation.de>
date Wed, 05 Apr 2006 15:39:48 +0200
parents ebf1ecb5f4e8
children f70952384ae7
files mercurial/mpatch.c
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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();