Skip to content

runtime/cgo: the object returned CFBundleCopyResourceURL should be released #19722

@echo2gold

Description

@echo2gold

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.8 darwin/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/mymac/workspace/gomobile"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/z1/4wwl0fpj7x7_8k42nnxxzs7r0000gn/T/go-build994212619=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

What did you do?

$ gomobile bind -v -target=ios golang.org/x/mobile/example/bind/hello

The hello example for binding with go has leak the memory type NSURL and CFString in init_working_dir().

https://github.com/golang/go/search?utf8=%E2%9C%93&q=CFBundleCopyResourceURL

The object returned CFBundleCopyResourceURL should be released because it's ownership follows the The Create Rule.

https://developer.apple.com/reference/corefoundation/1537117-cfbundlecopyresourceurl?language=objc

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions