Fixed crash on browsing corrupted RAW files

on behalf of Evgeny Andreeshchev; see issue 871
This commit is contained in:
Oliver Duis
2011-07-29 08:07:33 +02:00
parent 5aeb290622
commit 71683ee04b

View File

@@ -174,9 +174,8 @@ int RawImage::loadRaw (bool loadData, bool closeFile)
return 200; return 200;
if (setjmp (failure)) { if (setjmp (failure)) {
if (image) if (image) { free (image); image=NULL; }
free (image); fclose(ifp); ifp=NULL;
fclose (ifp);
return 100; return 100;
} }
@@ -200,10 +199,11 @@ int RawImage::loadRaw (bool loadData, bool closeFile)
cblack[c] -= i; cblack[c] -= i;
black += i; black += i;
} }
if( closeFile ){
fclose(ifp); if ( closeFile ) {
ifp=NULL; fclose(ifp); ifp=NULL;
} }
return 0; return 0;
} }