JuliaLang/julia

More libgit2 memory ownership issues

Open

#24,464 opened on Nov 3, 2017

View on GitHub
 (0 comments) (1 reaction) (0 assignees)Julia (48,709 stars) (5,773 forks)batch import
help wantedlibgit2

Description

https://github.com/JuliaLang/julia/blob/8cd97c5980c0a6fb0860996399f49b2679aedddd/base/libgit2/blob.jl#L21 ptr needs to be kept alive until the copy is done

msg_ptr needs to be scoped to c

The resulting signature needs to be duplicated or scoped to c

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.

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.

Same issue.

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

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).

Keep the git reference alive until the string is created

Same issue as the other getindex methods

Same issue

Object needs to be kept alive until the string result is created

Same in these four functions

The usual

The usual

oid_ptr needs to be appropriately scoped

And anything else I might have missed

Contributor guide