]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: hlua: fix leak in hlua_ckch_set() error path
authorAurelien DARRAGON <adarragon@haproxy.com>
Tue, 4 Jun 2024 13:15:29 +0000 (15:15 +0200)
committerAurelien DARRAGON <adarragon@haproxy.com>
Tue, 4 Jun 2024 14:31:30 +0000 (16:31 +0200)
commit755c2daf0f88885fd6825c55ae59198726c4905e
tree991ab6d4718e4e852bcd00f7d193a385fc1963f1
parent2be94c008ee0955c04fa4f92bd487229d4383879
BUG/MINOR: hlua: fix leak in hlua_ckch_set() error path

in hlua_ckch_commit_yield() and hlua_ckch_set(), when an error occurs,
we enter the error path and try to raise an error from the <err> msg
pointer which must be freed afterwards.

However, the fact that luaL_error() never returns was overlooked, because
of that <err> msg is never freed in such case.

To fix the issue, let's use hlua_pushfstring_safe() helper to push the
err on the lua stack and then free it before throwing the error using
lua_error().

It should be backported up to 2.6 with 30fcca18 ("MINOR: ssl/lua:
CertCache.set() allows to update an SSL certificate file")
src/hlua.c