source3/torture/vfstest.c(process_file): fixed file descriptor leak.
authorSlava Semushin <php-coder@altlinux.ru>
Mon, 25 May 2009 16:59:05 +0000 (23:59 +0700)
committerVolker Lendecke <vl@samba.org>
Fri, 5 Jun 2009 08:17:09 +0000 (10:17 +0200)
Found by cppcheck:
[./source3/torture/vfstest.c:400]: (error) Resource leak: file

source3/torture/vfstest.c

index de68a0b3c52d943061f99f8454593f77998ea8a8..2a191c2800a2fffa0061500edb567388d37bd98b 100644 (file)
@@ -397,6 +397,10 @@ static void process_file(struct vfs_state *pvfs, char *filename) {
        while (fgets(command, 3 * PATH_MAX, file) != NULL) {
                process_cmd(pvfs, command);
        }
+
+       if (file != stdin) {
+               fclose(file);
+       }
 }
 
 void exit_server(const char *reason)