Skip to content

Commit c7e8de1

Browse files
Fix leak in git_tag_create_from_buffer
If the tag already exists and we are not forcing overwrite we need to free ref_name buffer before return the "tag already exists" error.
1 parent a3841af commit c7e8de1

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/libgit2/tag.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ int git_tag_create_from_buffer(git_oid *oid, git_repository *repo, const char *b
397397
/** Ensure the tag name doesn't conflict with an already existing
398398
* reference unless overwriting has explicitly been requested **/
399399
if (error == 0 && !allow_ref_overwrite) {
400+
git_str_dispose(&ref_name);
400401
git_error_set(GIT_ERROR_TAG, "tag already exists");
401402
return GIT_EEXISTS;
402403
}

0 commit comments

Comments
 (0)