dfellis / h3-node

H3 binding to Node using N-API
MIT License
30 stars 5 forks source link

Clean up memory allocations on short-circuit paths #12

Closed dfellis closed 5 years ago

dfellis commented 5 years ago

Hat tip to @isaacbrodsky for pointing this issue out.

For now I've only implemented the cleanup functionality for the macros used in functions that actually allocate memory, and I've also abused a corner of the C spec so the calls still work as desired when no cleanup block is provided. Perhaps there's a better way to do this, though?