libs/web: fix file handle leak in template parser
authorJo-Philipp Wich <jow@openwrt.org>
Sun, 26 Jul 2009 23:11:36 +0000 (23:11 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Sun, 26 Jul 2009 23:11:36 +0000 (23:11 +0000)
libs/web/src/template_lualib.c

index 685613fbdcccad36dd9afd1c0964ac74d566464a..f91b19ceb85c07f1778771cc29d72b1adfa94feb 100644 (file)
@@ -29,8 +29,13 @@ int template_L_parse(lua_State *L)
                parser.flags   = 0;
                parser.bufsize = 0;
                parser.state   = T_STATE_TEXT_NEXT;
-               
-               if( !(lua_status = lua_load(L, template_reader, &parser, file)) )
+
+               lua_status = lua_load(L, template_reader, &parser, file);
+
+               (void) close(parser.fd);
+
+
+               if( lua_status == 0 )
                {
                        return 1;
                }