diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-02-26 16:51:07 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-02-26 16:55:58 +0000 |
commit | 2c316e86a137b0622863c18b2b6e9f09c693fbc3 (patch) | |
tree | e7f64475044f1c0c8cdc426451b7f37f536a4d46 /src/lua/lua_map.c | |
parent | 931e181c3202e5a92bcc614ec042fd46f032c4c3 (diff) | |
download | rspamd-2c316e86a137b0622863c18b2b6e9f09c693fbc3.tar.gz rspamd-2c316e86a137b0622863c18b2b6e9f09c693fbc3.zip |
[Fix] Fix maps object update race condition
Issue: #2467
Diffstat (limited to 'src/lua/lua_map.c')
-rw-r--r-- | src/lua/lua_map.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/lua/lua_map.c b/src/lua/lua_map.c index 98b025ea2..3ba7d0ed1 100644 --- a/src/lua/lua_map.c +++ b/src/lua/lua_map.c @@ -416,7 +416,7 @@ lua_map_read (gchar *chunk, gint len, } static void -lua_map_fin (struct map_cb_data *data) +lua_map_fin (struct map_cb_data *data, void **target) { struct lua_map_callback_data *cbdata; struct rspamd_lua_map **pmap; @@ -432,10 +432,6 @@ lua_map_fin (struct map_cb_data *data) return; } - if (data->prev_data) { - data->prev_data = NULL; - } - if (cbdata->ref == -1) { msg_err_map ("map has no callback set"); } @@ -454,6 +450,14 @@ lua_map_fin (struct map_cb_data *data) } cbdata->data = rspamd_fstring_assign (cbdata->data, "", 0); + + if (target) { + *target = data->cur_data; + } + + if (data->prev_data) { + data->prev_data = NULL; + } } static void |