Steps to reproduce:
- create a TIFF image (probably other formats would work) "sample.tiff";
- create and keep open in exclusive mode (no sharing allowed) a file named "sample.ficache";
- call img = FreeImage_OpenMultiBitmap (FIF_TIFF, "sample.tiff", 0, 0, 0, 0, 0), it returns FIMULTIBITMAP != NULL;
- call FreeImage_CloseMultiBitmap (img, 0)
- witness the invalid pointer operation.
The problem most likely comes from the FreeImage_OpenMultiBitmap: when it fails to open the locked cache file (if (cache_file->open())...). It then deletes the "header" and returns the "bitmap" variable with bitmap->header still pointing to the released memory. If probably should return NULL or, better yet, gracefully revert to using memory cache.
Log in to post a comment.