diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-07-18 15:32:39 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-07-18 15:32:39 +0400 |
commit | c66f2410104029edce0e18f76f2567a520cea165 (patch) | |
tree | 8fe716803eeb39ba680ba47bee454fdf01a25142 /src | |
parent | 08b350777c6b1d652cfa10b110f4a22a39318cd2 (diff) | |
download | rspamd-c66f2410104029edce0e18f76f2567a520cea165.tar.gz rspamd-c66f2410104029edce0e18f76f2567a520cea165.zip |
Fix bug with data corruption during settings application.
Diffstat (limited to 'src')
-rw-r--r-- | src/settings.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/settings.c b/src/settings.c index e0ca4805b..1eb5da2d6 100644 --- a/src/settings.c +++ b/src/settings.c @@ -135,7 +135,7 @@ json_fin_cb (memory_pool_t * pool, struct map_cb_data *data) jb = data->prev_data; /* Clean prev data */ if (jb->table) { - g_hash_table_remove_all (jb->table); + g_hash_table_unref (jb->table); } if (jb->buf) { g_free (jb->buf); @@ -547,10 +547,17 @@ apply_metric_settings (struct worker_task *task, struct metric *metric, struct m if (check_setting (task, &us, &ds)) { if (us != NULL || ds != NULL) { if (us != NULL) { + g_hash_table_ref (task->cfg->user_settings); res->user_settings = us; + memory_pool_add_destructor (task->task_pool, (pool_destruct_func)g_hash_table_unref, + task->cfg->user_settings); } if (ds != NULL) { + /* Need to ref hash table to avoid occasional data corruption */ + g_hash_table_ref (task->cfg->domain_settings); res->domain_settings = ds; + memory_pool_add_destructor (task->task_pool, (pool_destruct_func)g_hash_table_unref, + task->cfg->domain_settings); } } else { |