Commit 4ad45af5 authored by Alexander Alekhin's avatar Alexander Alekhin

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

parents 37a7e08b 2be955a0
...@@ -651,8 +651,15 @@ imdecode_( const Mat& buf, int flags, int hdrtype, Mat* mat=0 ) ...@@ -651,8 +651,15 @@ imdecode_( const Mat& buf, int flags, int hdrtype, Mat* mat=0 )
if( !f ) if( !f )
return 0; return 0;
size_t bufSize = buf.cols*buf.rows*buf.elemSize(); size_t bufSize = buf.cols*buf.rows*buf.elemSize();
fwrite( buf.ptr(), 1, bufSize, f ); if( fwrite( buf.ptr(), 1, bufSize, f ) != bufSize )
fclose(f); {
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); decoder->setSource(filename);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment