]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Remove missing dependencies from runtime checks
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 18 May 2018 13:01:19 +0000 (14:01 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 18 May 2018 13:01:19 +0000 (14:01 +0100)
src/libserver/symbols_cache.c

index eac6c8d0cbe41e3008dcfba53b19719a11e2c699..abed26fc346b99bf68185329583c7c05b7604b54 100644 (file)
@@ -415,7 +415,7 @@ rspamd_symbols_cache_post_init (struct symbols_cache *cache)
        struct delayed_cache_dependency *ddep;
        struct delayed_cache_condition *dcond;
        GList *cur;
-       guint i, j;
+       gint i, j;
        gint id;
 
        rspamd_symbols_cache_resort (cache);
@@ -506,6 +506,16 @@ rspamd_symbols_cache_post_init (struct symbols_cache *cache)
                                msg_err_cache ("cannot find dependency on symbol %s", dep->sym);
                        }
                }
+
+               /* Reversed loop to make removal safe */
+               for (j = it->deps->len - 1; j >= 0; j --) {
+                       dep = g_ptr_array_index (it->deps, j);
+
+                       if (dep->item == NULL) {
+                               /* Remove useless dep */
+                               g_ptr_array_remove_index (it->deps, j);
+                       }
+               }
        }
 
        g_ptr_array_sort_with_data (cache->prefilters, prefilters_cmp, cache);