# HG changeset patch # User mpm@selenic.com # Date 1118257278 28800 # Node ID 97d83e7fbf2f5f463e27a45ebc0c81e433f2a478 # Parent 574420507d8c771261156c812082e9ff10ddc991 mpatch: properly NULL out return in lalloc -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 mpatch: properly NULL out return in lalloc From: K Thananchayan manifest hash: 69952cb34e184eff19e3abff7638eb3a446f4dca -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCp0B+ywK+sNU5EO8RAuGdAJ4iZOnxExpZuhTjO0fcOFE9mNn/IACgjXbw 7mVqfBJeLbxViBorImLE12k= =A1Vj -----END PGP SIGNATURE----- diff --git a/mercurial/mpatch.c b/mercurial/mpatch.c --- 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;