uber / h3

Hexagonal hierarchical geospatial indexing system
https://h3geo.org
Apache License 2.0
4.92k stars 468 forks source link

Fix memory leak in compactCells #685

Closed isaacbrodsky closed 2 years ago

isaacbrodsky commented 2 years ago

This branch was previously thought unreachable, but evidently is. It resulted in a memory leak which allowed us to detect it. I added a test based on a specific bad input and assert that it returns failure, plus rely on Valgrind to detect if a leak happens; it may be possible to minify the test case even further.

We should convert these "unreachable" branches to assertions, at least for debug builds so we can be sure to find other such cases in e.g. fuzzing.

coveralls commented 2 years ago

Coverage Status

Coverage increased (+0.002%) to 99.037% when pulling e22eaf3b37357347ca9c61ef1e82406dcf5750ae on isaacbrodsky:fix-compactcells-leak into f581626150e2e2b02f0ee1636084dfb8a4563abf on uber:master.