Browse Source

Memory leak.

tags/0.9.0
Vsevolod Stakhov 9 years ago
parent
commit
26832a9237
3 changed files with 16 additions and 1 deletions
  1. 2
    1
      src/libstat/stat_process.c
  2. 8
    0
      src/libutil/util.c
  3. 6
    0
      src/libutil/util.h

+ 2
- 1
src/libstat/stat_process.c View File

@@ -95,7 +95,8 @@ 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);
rspamd_mempool_add_destructor (cbdata->task->task_pool,
rspamd_array_free_hard, t->results);

cur = g_list_first (cbdata->classifier_runtimes);


+ 8
- 0
src/libutil/util.c View File

@@ -2340,3 +2340,11 @@ rspamd_ptr_array_free_hard (gpointer p)

g_ptr_array_free (ar, TRUE);
}

void
rspamd_array_free_hard (gpointer p)
{
GArray *ar = (GArray *)p;

g_array_free (ar, TRUE);
}

+ 6
- 0
src/libutil/util.h View File

@@ -447,4 +447,10 @@ gdouble rspamd_get_ticks (void);
*/
void rspamd_ptr_array_free_hard (gpointer p);

/**
* Special utility to help array freeing in rspamd_mempool
* @param p
*/
void rspamd_array_free_hard (gpointer p);

#endif

Loading…
Cancel
Save