Commit 899ec41f by Evan Hanson

revparse: Free left side of invalid range revspecs

This fixes a small memory leak in git_revparse where early returns on
errors from git_revparse_single cause a free() on the (reallocated) left
side of the revspec to be skipped.
parent 1e94df08
...@@ -912,13 +912,9 @@ int git_revparse( ...@@ -912,13 +912,9 @@ int git_revparse(
rstr++; rstr++;
} }
if ((error = git_revparse_single(&revspec->from, repo, lstr)) < 0) { error = git_revparse_single(&revspec->from, repo, lstr);
return error; if (error == 0)
} error = git_revparse_single(&revspec->to, repo, rstr);
if ((error = git_revparse_single(&revspec->to, repo, rstr)) < 0) {
return error;
}
git__free((void*)lstr); git__free((void*)lstr);
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment