DanBloomberg / leptonica

Leptonica is an open source library containing software that is broadly useful for image processing and image analysis applications. The official github repository for Leptonica is: danbloomberg/leptonica. See leptonica.org for more documentation.
Other
1.74k stars 387 forks source link

Fix memory leak in pageseg_reg #651

Closed stweil closed 1 year ago

stweil commented 1 year ago

Signed-off-by: Stefan Weil sw@weilnetz.de

DanBloomberg commented 1 year ago

Thanks. Was that found by coverity scan?

stweil commented 1 year ago

No, only indirectly. I had run pageseg_reg to examine a leak which was reported by coverity scan and detected this one.

amitdo commented 1 year ago

Dan, Stefan,

How about adding a workflow that uses clang sanitizers with all Leptonica's programs? You can set it to run daily or weekly.

DanBloomberg commented 1 year ago

That might be too much for me to deal with, even assuming it is possible somehow to turn 300 programs into sanitizers. One thing we learned about sanitizers is that you don't want to test existing I/O libraries with it (it finds stuff you can't deal with), so for functions that need an image (most do), you need to use a simple encoding scheme -- Adam Korczynski and I settled on spix (un-encoded raster image) for payloads.

stweil commented 1 year ago

A first result of a local test with sanitizer flags shows indeed many issues (mainly from graphic libraries), but also detected the issue which I fixed in pull request #652.

stweil commented 1 year ago

The address sanitizer deteced some more issues. I added fixes for those to #652 now.

amitdo commented 1 year ago

Stefan,

Another thing you can run on Leptonica's codebase is clang-tidy (it also has all the default checkers included by scan-build).