progrium/darwinkit

free CString and CBytes

Closed this issue · 0 comments

mgood commented

(Making note so I don't forget, but I'll try to come back and fix this)

Based on the cgo docs CString and CBytes use malloc to allocate memory and must be released with C.free.

There are a number of uses throughout objc and core where it's used inline, e.g.:

C.GoObjc_RegisterSelector(C.CString(name))

We should go through and add C.free as needed for each of these.