If gflGetFileInformationFromMemory returns an error (for example if I call it with a PNG image and I set the index parameter to jpeg) then when I call gflFreeFileInformation, the application crash.
Here is a code example that crash if you call it with a PNG image. Works fine with a jpeg image:
Code: Select all
#include "libgfl.h"
#include <fstream>
using namespace std;
int main(int argc, char* argv[])
{
gflLibraryInit();
//Read file in memory
ifstream ficDoc (argv[1], ios::in|ios::binary|ios::ate);
int data_size = ficDoc.tellg();
GFL_UINT8* pData = new GFL_UINT8[data_size];
ficDoc.seekg (0, ios::beg);
ficDoc.read (reinterpret_cast<char*>(pData), data_size);
ficDoc.close();
GFL_FILE_INFORMATION m_GflFI;
gflGetFileInformationFromMemory(pData, data_size, gflGetFormatIndexByName("jpeg"), &m_GflFI);
gflFreeFileInformation(&m_GflFI);
return 0;
}
Best regards.
Ithier