duckdb / duckdb_spatial

MIT License
489 stars 40 forks source link

Fix memory leak in st_asgeojson, avoid copy #372

Closed Maxxen closed 3 months ago

Maxxen commented 3 months ago

yyjson doesn't use the allocator set during document creation by default when using the yyjson_mut_write function, instead allocating the result string through malloc (causing the string to be leaked), but we now use the advanced version taking options (such as which allocator to use) to make sure the resulting string is allocated by the arena. Additionally we also avoid copying the resulting json string to the vector string heap buffer now as we can just point into the arena instead, saving some memory.

Closes #371