From cadab3422ef3ad1d9561dd1e1ec1f56ec8a885d6 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Tue, 5 Oct 2010 15:06:52 +0200 Subject: [PATCH] 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 3d731333..86a749c7 100644 --- a/tools/quake3/common/vfs.c +++ b/tools/quake3/common/vfs.c @@ -302,7 +302,7 @@ int vfsLoadFile (const char *filename, void **bufferptr, int index) return -1; } - if(fread (*bufferptr, 1, len, f) != len) + if(fread (*bufferptr, 1, len, f) != (size_t) len) { fclose(f); return -1; @@ -341,9 +341,16 @@ 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 -- 2.39.2