final tweak for coverity

This commit is contained in:
John Cupitt 2015-09-30 14:42:53 +01:00
parent 864dfbf7aa
commit a67c1d6d57
1 changed files with 5 additions and 9 deletions

View File

@ -116,9 +116,9 @@ read_free( Read *read )
VIPS_FREEF( WebPIDelete, read->idec );
WebPFreeDecBuffer( &read->config.output );
if( read->fd &&
if( read->fd > 0 &&
read->data &&
read->length ) {
read->length > 0 ) {
vips__munmap( read->data, read->length );
read->data = NULL;
read->length = 0;
@ -152,13 +152,9 @@ read_new( const char *filename, void *data, size_t length )
* mmap the input file, it's slightly quicker.
*/
if( (read->fd = vips__open_image_read( read->filename )) < 0 ||
(read->length = vips_file_length( read->fd )) < 0 ) {
read_free( read );
return( NULL );
}
if( !(read->data =
vips__mmap( read->fd, FALSE, read->length, 0 )) ) {
(read->length = vips_file_length( read->fd )) < 0 ||
!(read->data = vips__mmap( read->fd,
FALSE, read->length, 0 )) ) {
read_free( read );
return( NULL );
}