]> git.proxmox.com Git - libgit2.git/blobdiff - src/revert.c
treebuilder: fix memory leaks in `write_with_buffer`
[libgit2.git] / src / revert.c
index b255245bfa487b881ed8ee84c2057ef4b143de65..747938fb33473a17be4fd6dfdb89053a2b5df76a 100644 (file)
@@ -27,7 +27,7 @@ static int write_revert_head(
        git_buf file_path = GIT_BUF_INIT;
        int error = 0;
 
-       if ((error = git_buf_joinpath(&file_path, repo->path_repository, GIT_REVERT_HEAD_FILE)) >= 0 &&
+       if ((error = git_buf_joinpath(&file_path, repo->gitdir, GIT_REVERT_HEAD_FILE)) >= 0 &&
                (error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_FORCE, GIT_REVERT_FILE_MODE)) >= 0 &&
                (error = git_filebuf_printf(&file, "%s\n", commit_oidstr)) >= 0)
                error = git_filebuf_commit(&file);
@@ -49,7 +49,7 @@ static int write_merge_msg(
        git_buf file_path = GIT_BUF_INIT;
        int error = 0;
 
-       if ((error = git_buf_joinpath(&file_path, repo->path_repository, GIT_MERGE_MSG_FILE)) < 0 ||
+       if ((error = git_buf_joinpath(&file_path, repo->gitdir, GIT_MERGE_MSG_FILE)) < 0 ||
                (error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_FORCE, GIT_REVERT_FILE_MODE)) < 0 ||
                (error = git_filebuf_printf(&file, "Revert \"%s\"\n\nThis reverts commit %s.\n",
                commit_msgline, commit_oidstr)) < 0)