aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-12-07 22:48:43 +0000
committerMatthew Wild <mwild1@gmail.com>2009-12-07 22:48:43 +0000
commit890f155ec2f62c0512de28c16c86c2660b129e08 (patch)
tree4007bdb92c2f20b8925592d6041d88508811f48d
parentd6d6e4d9daa4b43511fa287af616be259857429e (diff)
downloadluaevent-prosody-890f155ec2f62c0512de28c16c86c2660b129e08.tar.gz
luaevent-prosody-890f155ec2f62c0512de28c16c86c2660b129e08.zip
Fix potential stack slot leak when error occurs
-rw-r--r--src/buffer_event.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/buffer_event.c b/src/buffer_event.c
index 4e20353..0b956cf 100644
--- a/src/buffer_event.c
+++ b/src/buffer_event.c
@@ -49,7 +49,12 @@ static void handle_callback(le_bufferevent* le_ev, short what, int callbackIndex
/* func, bufferevent */
lua_pushinteger(L, what);
/* What to do w/ errors...? */
- lua_pcall(L, 2, 0, 0);
+ if(!lua_pcall(L, 2, 0, 0))
+ {
+ /* FIXME: Perhaps luaevent users should be
+ * able to set an error handler? */
+ lua_pop(L, 1); /* Pop error message */
+ }
}
static void buffer_event_readcb(struct bufferevent *ev, void *ptr) {