receive-pack: plug memory leak in fast-forward checking code.
Signed-off-by: Junio C Hamano <junkio@cox.net>maint
parent
11031d7e9f
commit
9edd7e4652
|
@ -131,15 +131,16 @@ static int update(struct command *cmd)
|
||||||
}
|
}
|
||||||
if (deny_non_fast_forwards && !is_null_sha1(old_sha1)) {
|
if (deny_non_fast_forwards && !is_null_sha1(old_sha1)) {
|
||||||
struct commit *old_commit, *new_commit;
|
struct commit *old_commit, *new_commit;
|
||||||
struct commit_list *bases;
|
struct commit_list *bases, *ent;
|
||||||
|
|
||||||
old_commit = (struct commit *)parse_object(old_sha1);
|
old_commit = (struct commit *)parse_object(old_sha1);
|
||||||
new_commit = (struct commit *)parse_object(new_sha1);
|
new_commit = (struct commit *)parse_object(new_sha1);
|
||||||
for (bases = get_merge_bases(old_commit, new_commit, 1);
|
bases = get_merge_bases(old_commit, new_commit, 1);
|
||||||
bases; bases = bases->next)
|
for (ent = bases; ent; ent = ent->next)
|
||||||
if (!hashcmp(old_sha1, bases->item->object.sha1))
|
if (!hashcmp(old_sha1, ent->item->object.sha1))
|
||||||
break;
|
break;
|
||||||
if (!bases)
|
free_commit_list(bases);
|
||||||
|
if (!ent)
|
||||||
return error("denying non-fast forward;"
|
return error("denying non-fast forward;"
|
||||||
" you should pull first");
|
" you should pull first");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue