about summary refs log tree commit diff
path: root/src/base
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2011-12-04 17:21:34 +0100
committeroy <Tom_Adams@web.de>2011-12-04 17:21:34 +0100
commit9221f3dda2b89dfa1f0294d402e45b96685b9693 (patch)
tree38e0c5a012739f89e470b53e9e197e3ab75b490f /src/base
parentc3a91f19b3633826046afc9fcfa5338f5a6a061e (diff)
downloadzcatch-9221f3dda2b89dfa1f0294d402e45b96685b9693.tar.gz
zcatch-9221f3dda2b89dfa1f0294d402e45b96685b9693.zip
added missing close for a file search handle
Diffstat (limited to 'src/base')
-rw-r--r--src/base/system.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/base/system.c b/src/base/system.c
index 301efdbd..4ea6d413 100644
--- a/src/base/system.c
+++ b/src/base/system.c
@@ -278,8 +278,13 @@ IOHANDLE io_open(const char *filename, int flags)
 		if(!filename || !length || filename[length-1] == '\\')
 			return 0x0;
 		handle = FindFirstFile(filename, &finddata);
-		if(handle == INVALID_HANDLE_VALUE || str_comp(filename+length-str_length(finddata.cFileName), finddata.cFileName))
+		if(handle == INVALID_HANDLE_VALUE)
 			return 0x0;
+		else if(str_comp(filename+length-str_length(finddata.cFileName), finddata.cFileName) != 0)
+		{
+			FindClose(handle);
+			return 0x0;
+		}
 		FindClose(handle);
 	#endif
 		return (IOHANDLE)fopen(filename, "rb");