From 39a8ddd6d9466d89de222ca8c305c07a196bea07 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Tue, 5 Oct 2010 15:06:52 +0200 Subject: [PATCH] q3map2: more warnings imported from netradiant, original commit message: > more warnings --- tools/quake3/common/vfs.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/quake3/common/vfs.c b/tools/quake3/common/vfs.c index 5f7433bc..2092b77f 100644 --- a/tools/quake3/common/vfs.c +++ b/tools/quake3/common/vfs.c @@ -303,7 +303,10 @@ int vfsLoadFile( const char *filename, void **bufferptr, int index ){ return -1; } - fread( *bufferptr, 1, len, f ); + if ( fread( *bufferptr, 1, len, f ) != (size_t) len ) { + fclose( f ); + return -1; + } fclose( f ); // we need to end the buffer with a 0 @@ -337,10 +340,14 @@ int vfsLoadFile( const char *filename, void **bufferptr, int index ){ *bufferptr = safe_malloc( len + 1 ); if ( *bufferptr == NULL ) { + fclose( f ); return -1; } - fread( *bufferptr, 1, len, f ); + if ( fread( *bufferptr, 1, len, f ) != (size_t) len ) { + fclose( f ); + return -1; + } fclose( f ); // we need to end the buffer with a 0