diff mbox series

ubus/lua: fix stack leak

Message ID 20210827112226.34985-1-nicola.pancheri@netduma.com
State New
Headers show
Series ubus/lua: fix stack leak | expand

Commit Message

nicola.pancheri@netduma.com Aug. 27, 2021, 11:22 a.m. UTC
From: Nicola Pancheri <nicola.pancheri@netduma.com>

Fixes leak in the Lua stack; the call to lua_next in the loop pushes two
values to the stack, therefore both values should be popped off the
stack.

Signed-off-by: Nicola Pancheri <nicola.pancheri@netduma.com>
---
 lua/ubus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/lua/ubus.c b/lua/ubus.c
index e2bb081..64fe338 100644
--- a/lua/ubus.c
+++ b/lua/ubus.c
@@ -238,7 +238,7 @@  ubus_lua_format_blob_array(lua_State *L, struct blob_buf *b, bool table)
 	{
 		if (!ubus_lua_format_blob(L, b, table))
 		{
-			lua_pop(L, 1);
+			lua_pop(L, 2);
 			return false;
 		}
 	}