mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-11 13:12:22 +00:00
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.
This commit is contained in:
parent
1e94df08da
commit
899ec41fa1
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user