]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Release backends more lately
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 27 Jun 2018 11:05:44 +0000 (12:05 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 27 Jun 2018 11:05:44 +0000 (12:05 +0100)
src/libutil/map.c

index 8f36541a2aabb631477dabdca5e44a485bf0e447..5a0c859a37673107a3454e18125fc9d10786b8a4 100644 (file)
@@ -1812,11 +1812,6 @@ rspamd_map_remove_all (struct rspamd_config *cfg)
        for (cur = cfg->maps; cur != NULL; cur = g_list_next (cur)) {
                map = cur->data;
 
-               for (i = 0; i < map->backends->len; i ++) {
-                       bk = g_ptr_array_index (map->backends, i);
-                       MAP_RELEASE (bk, "rspamd_map_backend");
-               }
-
                if (g_atomic_int_compare_and_exchange (&map->cache->available, 1, 0)) {
                        if (map->cur_cache_cbd) {
                                MAP_RELEASE (map->cur_cache_cbd->shm, "rspamd_http_map_cached_cbdata");
@@ -1840,6 +1835,11 @@ rspamd_map_remove_all (struct rspamd_config *cfg)
                        map->dtor (&cbdata);
                        *map->user_data = NULL;
                }
+
+               for (i = 0; i < map->backends->len; i ++) {
+                       bk = g_ptr_array_index (map->backends, i);
+                       MAP_RELEASE (bk, "rspamd_map_backend");
+               }
        }
 
        g_list_free (cfg->maps);