Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should be use C.CPLFree to release some pointer malloced by GDAL it self. #77

Closed
ningfc opened this issue Nov 9, 2021 · 1 comment
Closed

Comments

@ningfc
Copy link
Contributor

ningfc commented Nov 9, 2021

I got an exception when debug with function ToWKT,
// Fetch geometry as WKT func (geom Geometry) ToWKT() (string, error) { var p *C.char err := C.OGR_G_ExportToWkt(geom.cval, &p).Err() wkt := C.GoString(p) defer C.free(unsafe.Pointer(p)) // <--- Exception at this line return wkt, err }
image
I think this pointer should be release by use CPLFree. And I try to change C.free to C.CPLFree, it works.

@lukeroth
Copy link
Owner

Updated this function and others that free pointers allocated by the OGR library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants