commit df2c482: [Minor] Check for NULL first for sanity

Vsevolod Stakhov vsevolod at rspamd.com
Sat Jul 2 12:49:06 UTC 2022


Author: Vsevolod Stakhov
Date: 2022-07-02 13:37:29 +0100
URL: https://github.com/rspamd/rspamd/commit/df2c48232b78b20ad7834efa80a7b30a41597eeb

[Minor] Check for NULL first for sanity

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

diff --git a/src/lua/lua_http.c b/src/lua/lua_http.c
index c4dffa8f7..d7f8c74f4 100644
--- a/src/lua/lua_http.c
+++ b/src/lua/lua_http.c
@@ -1062,7 +1062,10 @@ lua_http_request (lua_State *L)
 	cbd->url = url;
 	cbd->auth = auth;
 	cbd->task = task;
-	cbd->up = rspamd_upstream_ref(up);
+
+	if (up) {
+		cbd->up = rspamd_upstream_ref(up);
+	}
 
 	if (cbd->cbref == -1) {
 		cbd->thread = lua_thread_pool_get_running_entry (cfg->lua_thread_pool);


More information about the Commits mailing list