diff mbox series

Lua: remove stack leftover in l_handler_wrapper()

Message ID 20181017124649.25843-1-christian.storm@siemens.com
State Accepted
Headers show
Series Lua: remove stack leftover in l_handler_wrapper() | expand

Commit Message

Storm, Christian Oct. 17, 2018, 12:46 p.m. UTC
The function l_handler_wrapper() is called by C code
only, hence there's no need to leave a return value
on Lua's stack.

Signed-off-by: Christian Storm <christian.storm@siemens.com>
---
 corelib/lua_interface.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Stefano Babic Oct. 22, 2018, 4:27 p.m. UTC | #1
On 17/10/18 14:46, Christian Storm wrote:
> The function l_handler_wrapper() is called by C code
> only, hence there's no need to leave a return value
> on Lua's stack.
> 
> Signed-off-by: Christian Storm <christian.storm@siemens.com>
> ---
>  corelib/lua_interface.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/corelib/lua_interface.c b/corelib/lua_interface.c
> index 3155174..94fc981 100644
> --- a/corelib/lua_interface.c
> +++ b/corelib/lua_interface.c
> @@ -938,6 +938,7 @@ static int l_handler_wrapper(struct img_type *img, void *data) {
>  	}
>  
>  	result = lua_tonumber(gL, -1);
> +	lua_pop(gL, 1);
>  	TRACE("[Lua handler] returned: %d",(int)result);
>  
>  	return (int) result;
> 

Applied to -master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/corelib/lua_interface.c b/corelib/lua_interface.c
index 3155174..94fc981 100644
--- a/corelib/lua_interface.c
+++ b/corelib/lua_interface.c
@@ -938,6 +938,7 @@  static int l_handler_wrapper(struct img_type *img, void *data) {
 	}
 
 	result = lua_tonumber(gL, -1);
+	lua_pop(gL, 1);
 	TRACE("[Lua handler] returned: %d",(int)result);
 
 	return (int) result;