commit 1ffd4fe: [Fix] Fix variables replacement in mempool
Vsevolod Stakhov
vsevolod at highsecure.ru
Tue Mar 10 16:00:06 UTC 2020
Author: Vsevolod Stakhov
Date: 2020-03-10 15:48:56 +0000
URL: https://github.com/rspamd/rspamd/commit/1ffd4fe64e1e3c9d4ae7cf942c7179a8715e4a63
[Fix] Fix variables replacement in mempool
---
src/libutil/mem_pool.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/libutil/mem_pool.c b/src/libutil/mem_pool.c
index 357e8b693..b92579e36 100644
--- a/src/libutil/mem_pool.c
+++ b/src/libutil/mem_pool.c
@@ -1186,6 +1186,15 @@ rspamd_mempool_set_variable (rspamd_mempool_t *pool,
else {
struct rspamd_mempool_variable *pvar;
+ if (r == 0) {
+ /* Existing entry, maybe need cleanup */
+ pvar = &kh_val (pool->priv->variables, it);
+
+ if (pvar->dtor) {
+ pvar->dtor (pvar->data);
+ }
+ }
+
pvar = &kh_val (pool->priv->variables, it);
pvar->data = value;
pvar->dtor = destructor;
More information about the Commits
mailing list