diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-09-18 15:53:20 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-09-18 15:53:20 +0100 |
commit | cd50e7bd57981b7b7a01eec88ae06968c625b2a7 (patch) | |
tree | 9e4a01bea6d6223f58a4980940403dd2fbcb8b9c /src/fuzzy_storage.c | |
parent | 907cc2eb616124abe41e7c1b525139a54f3cea8f (diff) | |
download | rspamd-cd50e7bd57981b7b7a01eec88ae06968c625b2a7.tar.gz rspamd-cd50e7bd57981b7b7a01eec88ae06968c625b2a7.zip |
[Minor] Fix some more issues
Found by: coverity scan
Diffstat (limited to 'src/fuzzy_storage.c')
-rw-r--r-- | src/fuzzy_storage.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c index d710de172..26950bbc9 100644 --- a/src/fuzzy_storage.c +++ b/src/fuzzy_storage.c @@ -1694,6 +1694,7 @@ rspamd_fuzzy_storage_sync (struct rspamd_main *rspamd_main, struct rspamd_control_reply rep; rep.reply.fuzzy_sync.status = 0; + rep.type = RSPAMD_CONTROL_FUZZY_SYNC; if (ctx->backend && worker->index == 0) { rspamd_fuzzy_process_updates_queue (ctx, local_db_name, FALSE); @@ -1734,8 +1735,8 @@ rspamd_fuzzy_storage_reload (struct rspamd_main *rspamd_main, worker->cf->options, rspamd_main->cfg, &err)) == NULL) { msg_err ("cannot open backend after reload: %e", err); - g_error_free (err); rep.reply.reload.status = err->code; + g_error_free (err); } else { rep.reply.reload.status = 0; @@ -1898,10 +1899,16 @@ rspamd_fuzzy_stat_to_ucl (struct rspamd_fuzzy_storage_ctx *ctx, gboolean ip_stat static int lua_fuzzy_add_pre_handler (lua_State *L) { - struct rspamd_worker *wrk = *(struct rspamd_worker **) + struct rspamd_worker *wrk, **pwrk = (struct rspamd_worker **) rspamd_lua_check_udata (L, 1, "rspamd{worker}"); struct rspamd_fuzzy_storage_ctx *ctx; + if (!pwrk) { + return luaL_error (L, "invalid arguments, worker + function are expected"); + } + + wrk = *pwrk; + if (wrk && lua_isfunction (L, 2)) { ctx = (struct rspamd_fuzzy_storage_ctx *)wrk->ctx; @@ -1923,10 +1930,16 @@ lua_fuzzy_add_pre_handler (lua_State *L) static int lua_fuzzy_add_post_handler (lua_State *L) { - struct rspamd_worker *wrk = *(struct rspamd_worker **) + struct rspamd_worker *wrk, **pwrk = (struct rspamd_worker **) rspamd_lua_check_udata (L, 1, "rspamd{worker}"); struct rspamd_fuzzy_storage_ctx *ctx; + if (!pwrk) { + return luaL_error (L, "invalid arguments, worker + function are expected"); + } + + wrk = *pwrk; + if (wrk && lua_isfunction (L, 2)) { ctx = (struct rspamd_fuzzy_storage_ctx *)wrk->ctx; |