More libgit2 memory ownership issues #24464
Labels
help wanted
Indicates that a maintainer wants help on an issue or pull request
libgit2
The libgit2 library or the LibGit2 stdlib module
julia/base/libgit2/blame.jl
Lines 31 to 39 in 8cd97c5
There's two issues here:
a)
hunk_ptr
points intoblame
, so the former needs to be scoped to the latter's lifetimeb) The signature objects inside the loaded BlameHunk are owned by
blame
, so they need to be duplicated or otherwise scoped toblame
.julia/base/libgit2/blob.jl
Line 21 in 8cd97c5
ptr needs to be kept alive until the
copy
is donejulia/base/libgit2/commit.jl
Lines 13 to 18 in 8cd97c5
msg_ptr needs to be scoped to c
julia/base/libgit2/commit.jl
Lines 27 to 31 in 8cd97c5
The resulting signature needs to be duplicated or scoped to
c
julia/base/libgit2/config.jl
Lines 195 to 224 in 8cd97c5
I suspect this is ok for regular uses of the iteration protocol, but it would be good to scope the ConfigEntry to the iterator that produced it.
julia/base/libgit2/diff.jl
Lines 113 to 121 in 8cd97c5
Two bugs:
a) delta_ptr needs to be scoped to the diff
b) the file names inside the Delta are scoped to the diff as well (see https://github.com/libgit2/libgit2/blob/master/src/diff_generate.c#L47).
Probably easiest to duplicate these rather than keep the diff around.
julia/base/libgit2/index.jl
Lines 170 to 176 in 8cd97c5
Same issue.
julia/base/libgit2/merge.jl
Line 46 in 8cd97c5
The result of the ccall is an interior pointer into the AnnotatedCommit, so we need to make sure to keep that alive until after the unsafe load
julia/base/libgit2/oid.jl
Line 28 in 8cd97c5
Need to keep the array alive until the hash is created (or even better let the array propagate to ccall, so ccall will do it for you).
julia/base/libgit2/oid.jl
Line 106 in 8cd97c5
Keep the git reference alive until the string is created
julia/base/libgit2/rebase.jl
Lines 31 to 39 in 8cd97c5
Same issue as the other getindex methods
julia/base/libgit2/rebase.jl
Lines 41 to 52 in 8cd97c5
Same issue
julia/base/libgit2/reference.jl
Lines 102 to 115 in 8cd97c5
Object needs to be kept alive until the string result is created
julia/base/libgit2/remote.jl
Lines 116 to 168 in 8cd97c5
Same in these four functions
julia/base/libgit2/status.jl
Lines 25 to 33 in 8cd97c5
The usual
julia/base/libgit2/tag.jl
Lines 54 to 75 in 8cd97c5
The usual
julia/base/libgit2/tree.jl
Lines 68 to 71 in 8cd97c5
oid_ptr needs to be appropriately scoped
And anything else I might have missed
The text was updated successfully, but these errors were encountered: