From: Ingo Molnar Date: Thu, 14 Apr 2005 11:58:00 GMT Subject: [patch] git: fix rare memory leak in rev-tree.c Message-ID: <20050414115800.GB14065@elte.hu> In-Reply-To: <20050414113527.GA13790@elte.hu> this patch fixes a rare memory leak in rev-tree.c. Ingo Signed-off-by: Ingo Molnar --- rev-tree.c.orig +++ rev-tree.c @@ -73,8 +73,11 @@ static int parse_commit(unsigned char *s rev->flags |= SEEN; buffer = bufptr = read_sha1_file(sha1, type, &size); - if (!buffer || strcmp(type, "commit")) + if (!buffer || strcmp(type, "commit")) { + if (buffer) + free(buffer); return -1; + } bufptr += 46; /* "tree " + "hex sha1" + "\n" */ while (!memcmp(bufptr, "parent ", 7) && !get_sha1_hex(bufptr+7, parent)) { add_relationship(rev, parent);