diff --git a/src/revparse.c b/src/revparse.c index 13778eb11..e03e3338c 100644 --- a/src/revparse.c +++ b/src/revparse.c @@ -277,7 +277,7 @@ static int dereference_to_type(git_object **out, git_object *obj, git_otype targ retcode = GIT_ERROR; } } - if (obj1 != obj) { + if (obj1 != obj && obj1 != obj2) { git_object_free(obj1); } obj1 = obj2;