aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2021-09-18 12:29:57 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2021-09-18 12:29:57 +0100
commit4041c2d64024f27488461e03fcd587dfbb34c4b0 (patch)
tree9af52fdbc4789fc8f35f164a414431ca37710b43 /src/lua
parent1589bd19ff7c841203c548de2c5897e0f0f22c6d (diff)
downloadrspamd-4041c2d64024f27488461e03fcd587dfbb34c4b0.tar.gz
rspamd-4041c2d64024f27488461e03fcd587dfbb34c4b0.zip
[Minor] Plug some leaks on error paths
Found by: coverity scan
Diffstat (limited to 'src/lua')
-rw-r--r--src/lua/lua_http.c6
-rw-r--r--src/lua/lua_rsa.c2
-rw-r--r--src/lua/lua_text.c6
-rw-r--r--src/lua/lua_url.c2
4 files changed, 15 insertions, 1 deletions
diff --git a/src/lua/lua_http.c b/src/lua/lua_http.c
index d85664ef0..a92c1fe8f 100644
--- a/src/lua/lua_http.c
+++ b/src/lua/lua_http.c
@@ -978,6 +978,12 @@ lua_http_request (lua_State *L)
}
if (ev_base == NULL) {
+ g_free (auth);
+ rspamd_http_message_unref (msg);
+ if (body) {
+ rspamd_fstring_free (body);
+ }
+
return luaL_error (L,
"Bad params to rspamd_http:request(): ev_base isn't passed");
}
diff --git a/src/lua/lua_rsa.c b/src/lua/lua_rsa.c
index 4b2caa2bf..5e34bc2c6 100644
--- a/src/lua/lua_rsa.c
+++ b/src/lua/lua_rsa.c
@@ -664,6 +664,8 @@ lua_rsa_sign_memory (lua_State *L)
signature->str, (guint *)&signature->len, rsa);
if (ret != 1) {
+ rspamd_fstring_free (signature);
+
return luaL_error (L, "cannot sign: %s",
ERR_error_string (ERR_get_error (), NULL));
}
diff --git a/src/lua/lua_text.c b/src/lua/lua_text.c
index dde7e2c23..bec16c3b6 100644
--- a/src/lua/lua_text.c
+++ b/src/lua/lua_text.c
@@ -920,6 +920,10 @@ lua_text_split (lua_State *L)
struct rspamd_lua_regexp *re;
gboolean stringify = FALSE, own_re = FALSE;
+ if (t == NULL) {
+ return luaL_error (L, "invalid arguments");
+ }
+
if (lua_type (L, 2) == LUA_TUSERDATA) {
re = lua_check_regexp (L, 2);
}
@@ -947,7 +951,7 @@ lua_text_split (lua_State *L)
own_re = TRUE;
}
- if (t && re) {
+ if (re) {
if (lua_isboolean (L, 3)) {
stringify = lua_toboolean (L, 3);
}
diff --git a/src/lua/lua_url.c b/src/lua/lua_url.c
index 3298c7bed..26dd1eb7c 100644
--- a/src/lua/lua_url.c
+++ b/src/lua/lua_url.c
@@ -1169,6 +1169,8 @@ lua_url_cbdata_fill (lua_State *L,
}
else {
msg_info ("bad url protocol: %s", *cvec);
+ g_strfreev (strvec);
+
return FALSE;
}