summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2009-07-26 23:11:36 +0000
committerJo-Philipp Wich <jow@openwrt.org>2009-07-26 23:11:36 +0000
commit047d4e45f6d26d54d2019ff3d12e372fae3f2e22 (patch)
treebdfb0cc6c8e21db3452a24e937c27269591c8d11
parent1b557b0b7b2ebed0b8752ec3b676e801c6ba9043 (diff)
libs/web: fix file handle leak in template parser
-rw-r--r--libs/web/src/template_lualib.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libs/web/src/template_lualib.c b/libs/web/src/template_lualib.c
index 685613fbdc..f91b19ceb8 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;
}