diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-09-19 12:08:48 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-09-19 12:08:48 +0100 |
commit | 19424515ec8b3dcb133cef30bf10f8c6b19cc3aa (patch) | |
tree | f38a63933f8164f0a39a60cf04f628d5eef52fcb /src/lua/lua_dns_resolver.c | |
parent | b5a184a0f8b376f3917f103b637a3db17925d2ae (diff) | |
download | rspamd-19424515ec8b3dcb133cef30bf10f8c6b19cc3aa.tar.gz rspamd-19424515ec8b3dcb133cef30bf10f8c6b19cc3aa.zip |
[Minor] Fix some leaks on error paths
Found by: coverity scan
Diffstat (limited to 'src/lua/lua_dns_resolver.c')
-rw-r--r-- | src/lua/lua_dns_resolver.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/lua/lua_dns_resolver.c b/src/lua/lua_dns_resolver.c index 7eaa54da6..f43267dc6 100644 --- a/src/lua/lua_dns_resolver.c +++ b/src/lua/lua_dns_resolver.c @@ -504,16 +504,18 @@ lua_dns_resolver_resolve_common (lua_State *L, } return 1; + err: + /* Callback is not called in this case */ + if (cbdata->cbref != -1) { + luaL_unref (L, LUA_REGISTRYINDEX, cbdata->cbref); + } + if (!pool) { /* Free resources */ g_free (cbdata->to_resolve); g_free (cbdata->user_str); - } - - /* Callback is not called in this case */ - if (cbdata->cbref != -1) { - luaL_unref (L, LUA_REGISTRYINDEX, cbdata->cbref); + g_free (cbdata); } lua_pushnil (L); |