]> source.dussan.org Git - rspamd.git/commitdiff
Fix initialization order.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 27 Jan 2015 22:18:04 +0000 (22:18 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 27 Jan 2015 22:18:04 +0000 (22:18 +0000)
src/libstat/stat_process.c

index 9795b81fa98bc42884e16daccf753f0441f5ea38..2b1fd629c0d5bbfb4d7ca0d1ba8ee066c7a6fce7 100644 (file)
@@ -80,6 +80,7 @@ preprocess_init_stat_token (gpointer k, gpointer v, gpointer d)
 
        t->results = g_array_sized_new (FALSE, TRUE,
                        sizeof (struct rspamd_token_result), cbdata->results_count);
+       g_array_set_size (t->results, cbdata->results_count);
 
        cur = g_list_first (cbdata->classifier_runtimes);
 
@@ -97,14 +98,13 @@ preprocess_init_stat_token (gpointer k, gpointer v, gpointer d)
                        continue;
                }
 
-               res = &g_array_index (t->results, struct rspamd_token_result, i);
-
                curst = cl_runtime->st_runtime;
-               res->cl_runtime = cl_runtime;
 
                while (curst) {
-                       st_runtime = (struct rspamd_statfile_runtime *)curst->data;
 
+                       st_runtime = (struct rspamd_statfile_runtime *)curst->data;
+                       res = &g_array_index (t->results, struct rspamd_token_result, i);
+                       res->cl_runtime = cl_runtime;
                        res->st_runtime = st_runtime;
 
                        if (st_runtime->backend->process_token (t, res,