Skip to content

Commit

Permalink
receive-pack: plug memory leak in fast-forward checking code.
Browse files Browse the repository at this point in the history
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Johannes Schindelin authored and Junio C Hamano committed Sep 21, 2006
1 parent 11031d7 commit 9edd7e4
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions receive-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 9edd7e4

Please sign in to comment.