commit 077cee7: [Minor] Fix more error paths in Lua

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Sep 21 11:28:04 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-09-21 11:38:17 +0100
URL: https://github.com/rspamd/rspamd/commit/077cee773330eda0b994b7b70fa1d6ec307db478

[Minor] Fix more error paths in Lua
Found by: coverity scan

---
 src/lua/lua_http.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/lua/lua_http.c b/src/lua/lua_http.c
index 68c9bb927..2f1a1c5a7 100644
--- a/src/lua/lua_http.c
+++ b/src/lua/lua_http.c
@@ -969,6 +969,9 @@ lua_http_request (lua_State *L)
 		if (body) {
 			rspamd_fstring_free (body);
 		}
+		if (local_kp) {
+			rspamd_keypair_unref (local_kp);
+		}
 
 		return 1;
 	}
@@ -978,6 +981,9 @@ lua_http_request (lua_State *L)
 		if (body) {
 			rspamd_fstring_free (body);
 		}
+		if (local_kp) {
+			rspamd_keypair_unref (local_kp);
+		}
 
 		return luaL_error (L,
 				"Bad params to rspamd_http:request(): either task or config should be set");
@@ -989,6 +995,9 @@ lua_http_request (lua_State *L)
 		if (body) {
 			rspamd_fstring_free (body);
 		}
+		if (local_kp) {
+			rspamd_keypair_unref (local_kp);
+		}
 
 		return luaL_error (L,
 				"Bad params to rspamd_http:request(): ev_base isn't passed");


More information about the Commits mailing list