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(
rstr++;
}
if ((error = git_revparse_single(&revspec->from, repo, lstr)) < 0) {
return error;
}
if ((error = git_revparse_single(&revspec->to, repo, rstr)) < 0) {
return error;
}
error = git_revparse_single(&revspec->from, repo, lstr);
if (error == 0)
error = git_revparse_single(&revspec->to, repo, rstr);
git__free((void*)lstr);
} 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