Segfault switching between JPEG images in SETM, Issue 2636
This commit is contained in:
@@ -142,8 +142,8 @@ void ImageIO::setOutputProfile (char* pdata, int plen) {
|
||||
ImageIO::~ImageIO () {
|
||||
|
||||
if (embProfile)
|
||||
cmsCloseProfile(embProfile);
|
||||
delete [] loadedProfileData;
|
||||
cmsCloseProfile(embProfile);
|
||||
deleteLoadedProfileData();
|
||||
delete exifRoot;
|
||||
delete [] profileData;
|
||||
}
|
||||
@@ -339,7 +339,7 @@ int ImageIO::loadPNG (Glib::ustring fname) {
|
||||
}
|
||||
|
||||
int ImageIO::loadJPEGFromMemory (const char* buffer, int bufsize)
|
||||
{
|
||||
{
|
||||
jpeg_decompress_struct cinfo;
|
||||
jpeg_error_mgr jerr;
|
||||
cinfo.err = my_jpeg_std_error(&jerr);
|
||||
@@ -359,10 +359,8 @@ int ImageIO::loadJPEGFromMemory (const char* buffer, int bufsize)
|
||||
//jpeg_memory_src (&cinfo,buffer,bufsize);
|
||||
jpeg_read_header(&cinfo, TRUE);
|
||||
|
||||
if( loadedProfileData ){
|
||||
delete [] loadedProfileData;
|
||||
loadedProfileData = NULL;
|
||||
}
|
||||
deleteLoadedProfileData();
|
||||
loadedProfileDataJpg = true;
|
||||
bool hasprofile = read_icc_profile (&cinfo, (JOCTET**)&loadedProfileData, (unsigned int*)&loadedProfileLength);
|
||||
if (hasprofile)
|
||||
embProfile = cmsOpenProfileFromMem (loadedProfileData, loadedProfileLength);
|
||||
@@ -406,7 +404,6 @@ int ImageIO::loadJPEGFromMemory (const char* buffer, int bufsize)
|
||||
}
|
||||
|
||||
int ImageIO::loadJPEG (Glib::ustring fname) {
|
||||
|
||||
FILE *file=safe_g_fopen(fname,"rb");
|
||||
if (!file)
|
||||
return IMIO_CANNOTREADFILE;
|
||||
@@ -435,8 +432,8 @@ int ImageIO::loadJPEG (Glib::ustring fname) {
|
||||
return IMIO_READERROR;
|
||||
}
|
||||
|
||||
delete loadedProfileData;
|
||||
loadedProfileData = NULL;
|
||||
deleteLoadedProfileData();
|
||||
loadedProfileDataJpg = true;
|
||||
bool hasprofile = read_icc_profile (&cinfo, (JOCTET**)&loadedProfileData, (unsigned int*)&loadedProfileLength);
|
||||
if (hasprofile)
|
||||
embProfile = cmsOpenProfileFromMem (loadedProfileData, loadedProfileLength);
|
||||
@@ -651,10 +648,8 @@ int ImageIO::loadTIFF (Glib::ustring fname) {
|
||||
|
||||
|
||||
char* profdata;
|
||||
if( loadedProfileData ){
|
||||
delete [] loadedProfileData;
|
||||
loadedProfileData = NULL;
|
||||
}
|
||||
deleteLoadedProfileData();
|
||||
loadedProfileDataJpg = false;
|
||||
if (TIFFGetField(in, TIFFTAG_ICCPROFILE, &loadedProfileLength, &profdata)) {
|
||||
embProfile = cmsOpenProfileFromMem (profdata, loadedProfileLength);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user