aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2022-09-24 14:41:30 +0100
committerVsevolod Stakhov <vsevolod@rspamd.com>2022-09-24 14:41:30 +0100
commit213a260e6f190764cb3dd0868f10232a051b1f3a (patch)
tree1778cb21c37548d427b40bd7f63bf6d6f2f51f10
parent1d14bc6468d97834806668b437c26f20630fdc7c (diff)
downloadrspamd-213a260e6f190764cb3dd0868f10232a051b1f3a.tar.gz
rspamd-213a260e6f190764cb3dd0868f10232a051b1f3a.zip
[Minor] Add some error reporting
-rw-r--r--src/lua/lua_task.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index e2634ce34..263ec484e 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -5864,19 +5864,25 @@ lua_task_set_milter_reply (lua_State *L)
ucl_object_t *ar = ucl_object_typed_new (UCL_ARRAY);
ucl_array_append (ar, ucl_object_ref (existing));
- ucl_object_replace_key ((ucl_object_t *)add_hdrs,
+ /* Avoid double refcount */
+ key = ucl_object_keyl (existing, &klen);
+ ucl_object_delete_keyl ((ucl_object_t *)add_hdrs, key, klen);
+ ucl_object_insert_key ((ucl_object_t *)add_hdrs,
ar, key, klen, false);
}
}
}
- ucl_object_merge (prev, reply, false);
- ucl_object_unref (reply);
+ if (!ucl_object_merge (prev, reply, false)) {
+ msg_err_task ("internal error: cannot merge two objects when setting milter reply!");
+ }
+ ucl_object_unref(reply);
}
else {
rspamd_mempool_set_variable (task->task_pool,
RSPAMD_MEMPOOL_MILTER_REPLY,
- reply, (rspamd_mempool_destruct_t) ucl_object_unref);
+ reply,
+ (rspamd_mempool_destruct_t) ucl_object_unref);
}
}
else {