From: Jo-Philipp Wich Date: Sun, 26 Jul 2009 23:11:36 +0000 (+0000) Subject: libs/web: fix file handle leak in template parser X-Git-Tag: 0.10.0~1294 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=047d4e45f6d26d54d2019ff3d12e372fae3f2e22;p=oweals%2Fluci.git libs/web: fix file handle leak in template parser --- diff --git a/libs/web/src/template_lualib.c b/libs/web/src/template_lualib.c index 685613fbd..f91b19ceb 100644 --- a/libs/web/src/template_lualib.c +++ b/libs/web/src/template_lualib.c @@ -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; }