Fixed stack overflow issue. (Forgot to pop error/integer)

Mon, 11 Jun 2007 01:52:16 +0000

author
Thomas Harning Jr <harningt@gmail.com>
date
Mon, 11 Jun 2007 01:52:16 +0000
changeset 4
4d0e9388214a
parent 3
5999243fab1d
child 5
205a6b09e3bd

Fixed stack overflow issue. (Forgot to pop error/integer)

luaevent/src/luaevent.c file | annotate | diff | comparison | revisions
--- a/luaevent/src/luaevent.c	Mon Jun 11 01:24:10 2007 +0000
+++ b/luaevent/src/luaevent.c	Mon Jun 11 01:52:16 2007 +0000
@@ -45,6 +45,7 @@
 	lua_pushinteger(L, event);
 	if(lua_pcall(L, 1, 1, 0) || !lua_isnumber(L, -1)) {
 		printf("ERROR IN CB: %s\n", lua_tostring(L, -1));
+		lua_pop(L, 1);
 		freeCallbackArgs(arg);
 		return;
 	}
@@ -119,6 +120,7 @@
 	/* Call the callback with all arguments after it to get the loop primed.. */
 	if(lua_pcall(L, top - 2, 1, 0) || !lua_isnumber(L, -1)) {
 		printf("ERROR IN INIT: %s\n", lua_tostring(L, -1));
+		lua_pop(L, 1);
 		return 0;
 	}
 	ret = lua_tointeger(L, -1);

mercurial