mpatch: properly NULL out return in lalloc
authormpm@selenic.com
Wed, 08 Jun 2005 11:01:18 -0800
changeset 282 97d83e7fbf2f
parent 281 574420507d8c
child 283 18c9566ad717
mpatch: properly NULL out return in lalloc -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 mpatch: properly NULL out return in lalloc From: K Thananchayan <thananck@yahoo.com> manifest hash: 69952cb34e184eff19e3abff7638eb3a446f4dca -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCp0B+ywK+sNU5EO8RAuGdAJ4iZOnxExpZuhTjO0fcOFE9mNn/IACgjXbw 7mVqfBJeLbxViBorImLE12k= =A1Vj -----END PGP SIGNATURE-----
mercurial/mpatch.c
--- a/mercurial/mpatch.c	Wed Jun 08 10:59:18 2005 -0800
+++ b/mercurial/mpatch.c	Wed Jun 08 11:01:18 2005 -0800
@@ -44,9 +44,10 @@
 	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;