taskolib / libgit4cpp

C++ wrapper for libgit2 with limited functionality
https://taskolib.github.io/libgit4cpp/
GNU Lesser General Public License v2.1
1 stars 0 forks source link

Possible memory leak in remote_branch_name() #15

Closed Finii closed 6 months ago

Finii commented 6 months ago

I stumbled about this code:

std::string branch_remote_name(git_repository* repo, const std::string& branch_name)
{
    git_buf buf;
    if (git_branch_remote_name(&buf, repo, branch_name.c_str()))
    {
        // gul14::cat("branch_remote_name: ", git_error_last()->message);
        return "";
    }
    return buf.ptr;
}

Do we not need to call git_buf_dispose(buf) ?

No time to investigate, code not used anyhow, just to not forget.

Finii commented 6 months ago

Solved via