diff options
Diffstat (limited to 'src/refs.c')
-rw-r--r-- | src/refs.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/refs.c b/src/refs.c index 360e65373..ff5e24067 100644 --- a/src/refs.c +++ b/src/refs.c @@ -1052,12 +1052,10 @@ static int get_terminal(git_reference **out, git_repository *repo, const char *r error = 0; } else { error = get_terminal(out, repo, git_reference_symbolic_target(ref), nesting + 1); - if (error == GIT_ENOTFOUND) { - if (!*out) /* set by the error case in lookup above */ - *out = ref; - } else { + if (error == GIT_ENOTFOUND && !*out) + *out = ref; + else git_reference_free(ref); - } } return error; |