mirror of
https://git.proxmox.com/git/libgit2
synced 2025-08-04 18:56:59 +00:00
Invalid ref name normalization leaked memory
When normalizing a reference name, if there is an error because the name is invalid, then the memory allocated for storing the name could be leaked if the caller was not careful and assumed that the error return code meant that no allocation had occurred. This fixes that by explicitly deallocating the reference name buffer if there is an error in normalizing the name.
This commit is contained in:
parent
f616a36bdd
commit
3865f7f661
@ -1729,6 +1729,9 @@ cleanup:
|
||||
GITERR_REFERENCE,
|
||||
"The given reference name '%s' is not valid", name);
|
||||
|
||||
if (error && normalize)
|
||||
git_buf_free(buf);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user