commit 213a260: [Minor] Add some error reporting
Vsevolod Stakhov
vsevolod at rspamd.com
Sat Sep 24 19:07:08 UTC 2022
Author: Vsevolod Stakhov
Date: 2022-09-24 14:41:30 +0100
URL: https://github.com/rspamd/rspamd/commit/213a260e6f190764cb3dd0868f10232a051b1f3a
[Minor] Add some error reporting
---
src/lua/lua_task.c | 14 ++++++++++----
1 file 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 {
More information about the Commits
mailing list