summaryrefslogtreecommitdiff
path: root/receive-pack.c
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2006-09-21 02:07:19 +0200
committerJunio C Hamano <junkio@cox.net>2006-09-20 22:37:50 -0700
commit9edd7e4652e080a1a3b1ef614d22eba75b39ef87 (patch)
treecc2e86749170c5c7354997f708a76a3e2e544189 /receive-pack.c
parent11031d7e9f34f6a20ff4a4bd4fa3e5e3c0024a57 (diff)
downloadgit-9edd7e4652e080a1a3b1ef614d22eba75b39ef87.tar.gz
receive-pack: plug memory leak in fast-forward checking code.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'receive-pack.c')
-rw-r--r--receive-pack.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/receive-pack.c b/receive-pack.c
index a6ec9f900d..ea2dbd4e33 100644
--- a/receive-pack.c
+++ b/receive-pack.c
@@ -131,17 +131,18 @@ static int update(struct command *cmd)
}
if (deny_non_fast_forwards && !is_null_sha1(old_sha1)) {
struct commit *old_commit, *new_commit;
- struct commit_list *bases;
+ struct commit_list *bases, *ent;
old_commit = (struct commit *)parse_object(old_sha1);
new_commit = (struct commit *)parse_object(new_sha1);
- for (bases = get_merge_bases(old_commit, new_commit, 1);
- bases; bases = bases->next)
- if (!hashcmp(old_sha1, bases->item->object.sha1))
+ bases = get_merge_bases(old_commit, new_commit, 1);
+ for (ent = bases; ent; ent = ent->next)
+ if (!hashcmp(old_sha1, ent->item->object.sha1))
break;
- if (!bases)
+ free_commit_list(bases);
+ if (!ent)
return error("denying non-fast forward;"
- " you should pull first");
+ " you should pull first");
}
safe_create_leading_directories(lock_name);