Free allocated memory before luaL_error() in screen_input()
authorRui Guo <firemeteor.guo@gmail.com>
Wed, 17 Jun 2009 13:28:11 +0000 (17 21:28 +0800)
committerRui Guo <firemeteor.guo@gmail.com>
Wed, 17 Jun 2009 13:28:11 +0000 (17 21:28 +0800)
src/lua.c

index f24420f..fb00b38 100644 (file)
--- a/src/lua.c
+++ b/src/lua.c
@@ -794,7 +794,10 @@ screen_input(lua_State *L)
 
   sidata = (struct sinput_data *)malloc(sizeof(struct sinput_data));
   if (!sidata)
-    luaL_error(L, "Out of Memory");
+    {
+      Free(lh);
+      luaL_error(L, "Out of Memory");
+    }
 
   sidata->L = L;
   sidata->lh = lh;