From 212fd9353e9a95aacbb6df9047bc5ac63e9901b9 Mon Sep 17 00:00:00 2001 From: Luca Marturana Date: Fri, 2 Dec 2016 16:13:37 +0100 Subject: [PATCH] Push formatter on lua stack only if does not throw exceptions --- userspace/engine/formats.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/userspace/engine/formats.cpp b/userspace/engine/formats.cpp index 625f9cbf..7be6eaab 100644 --- a/userspace/engine/formats.cpp +++ b/userspace/engine/formats.cpp @@ -49,14 +49,13 @@ int falco_formats::formatter(lua_State *ls) try { formatter = new sinsp_evt_formatter(s_inspector, format); + lua_pushlightuserdata(ls, formatter); } catch(sinsp_exception& e) { luaL_error(ls, "Invalid output format '%s': '%s'", format.c_str(), e.what()); } - lua_pushlightuserdata(ls, formatter); - return 1; }