BUG/MINOR: hlua: fix unsafe lua_tostring() usage with empty stack

Lua documentation says that lua_tostring() returns a pointer that remains
valid as long as the object is not removed from the stack.

However there are some places were we use the returned string AFTER the
corresponding object is removed from the stack. In practise this doesn't
seem to cause visible bugs (probably because the pointer remains valid
waiting for a GC cycle), but let's fix that to comply with the
documentation and avoid undefined behavior.

It should be backported in all stable versions.

(cherry picked from commit 5508db9a20d995804edccd48144292ab1b8d8b08)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit f4dc0816327b446ad4af63d458c9f9bfdbf9fc53)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
1 file changed