HEIF loader: Call heif_[de]init() on loader load/unload

Seems to be required as of libheif-1.16.

Note - Running the tests with valgrind shows no problems, but with asan
enabled I get a bunch of messages like:

Direct leak of 8 byte(s) in 1 object(s) allocated from:
    #0 0x7f186d98ee38 in operator new(unsigned long) (/lib64/libasan.so.8+0xd9e38) (BuildId: bac59ca9f1e357781008d7f6982314d30ca62672)
    #1 0x7f186c4acec9 in ColorConversionPipeline::init_ops() [clone .part.0] (/lib64/libheif.so.1+0x6fec9) (BuildId: 2823b8c3a24fbf4262672d27ed3bf5a338d185b5)
    #2 0x7f186c4a2dec in heif_init (/lib64/libheif.so.1+0x65dec) (BuildId: 2823b8c3a24fbf4262672d27ed3bf5a338d185b5)
    #3 0x7f186d824d4e in __imlib_ProduceLoader ../../../../src/lib/loaders.c:209
This commit is contained in:
Kim Woelders 2023-04-29 21:53:21 +02:00
parent 875faa3fdc
commit 4b4f72c7ff
1 changed files with 17 additions and 0 deletions

View File

@ -172,4 +172,21 @@ _load(ImlibImage * im, int load_data)
return rc;
}
#if !LIBHEIF_HAVE_VERSION(1, 13, 0)
IMLIB_LOADER_KEEP(_formats, _load, NULL);
#else
static void
_inex(int init)
{
if (init)
heif_init(NULL);
else
heif_deinit();
}
IMLIB_LOADER_INEX(_formats, _load, NULL, _inex);
#endif