mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-11 20:13:24 +00:00
reference_rename: make sure old_name gets freed
Signed-off-by: schu <schu-github@schulog.org>
This commit is contained in:
parent
b08683ffb2
commit
ca6f203c59
@ -1290,7 +1290,7 @@ int git_reference_set_target(git_reference *ref, const char *target)
|
|||||||
int git_reference_rename(git_reference *ref, const char *new_name, int force)
|
int git_reference_rename(git_reference *ref, const char *new_name, int force)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
char *old_name = git__strdup(ref->name);
|
char *old_name = NULL;
|
||||||
|
|
||||||
char aux_path[GIT_PATH_MAX];
|
char aux_path[GIT_PATH_MAX];
|
||||||
char normalized[GIT_REFNAME_MAX];
|
char normalized[GIT_REFNAME_MAX];
|
||||||
@ -1328,6 +1328,8 @@ int git_reference_rename(git_reference *ref, const char *new_name, int force)
|
|||||||
* the new reference, e.g. when renaming foo/bar -> foo.
|
* the new reference, e.g. when renaming foo/bar -> foo.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
old_name = git__strdup(ref->name);
|
||||||
|
|
||||||
if (ref->type & GIT_REF_SYMBOLIC) {
|
if (ref->type & GIT_REF_SYMBOLIC) {
|
||||||
if ((target_ref = git_reference_target(ref)) == NULL)
|
if ((target_ref = git_reference_target(ref)) == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
Loading…
Reference in New Issue
Block a user