1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 15:53:03 +04:00

Merge pull request #9253 from jbms:fix/image-decoding-tempfile

This commit is contained in:
Alexander Alekhin
2017-08-01 13:47:15 +00:00
+9 -2
View File
@@ -651,8 +651,15 @@ imdecode_( const Mat& buf, int flags, int hdrtype, Mat* mat=0 )
if( !f )
return 0;
size_t bufSize = buf.cols*buf.rows*buf.elemSize();
fwrite( buf.ptr(), 1, bufSize, f );
fclose(f);
if( fwrite( buf.ptr(), 1, bufSize, f ) != bufSize )
{
fclose( f );
CV_Error( CV_StsError, "failed to write image data to temporary file" );
}
if( fclose(f) != 0 )
{
CV_Error( CV_StsError, "failed to write image data to temporary file" );
}
decoder->setSource(filename);
}