hdrs = g_mime_object_get_headers (GMIME_OBJECT (part));
mime_part->raw_headers = g_hash_table_new (rspamd_strcase_hash,
rspamd_strcase_equal);
- rspamd_mempool_add_destructor (task->task_pool,
- (rspamd_mempool_destruct_t) g_hash_table_unref,
- mime_part->raw_headers);
+
if (hdrs != NULL) {
process_raw_headers (task, mime_part->raw_headers,
hdrs, strlen (hdrs));
- g_free (hdrs);
+ mime_part->raw_headers_str = hdrs;
}
mime_part->type = type;
hdrs = g_mime_object_get_headers (GMIME_OBJECT (part));
mime_part->raw_headers = g_hash_table_new (rspamd_strcase_hash,
rspamd_strcase_equal);
- rspamd_mempool_add_destructor (task->task_pool,
- (rspamd_mempool_destruct_t) g_hash_table_unref,
- mime_part->raw_headers);
+
if (hdrs != NULL) {
process_raw_headers (task, mime_part->raw_headers,
hdrs, strlen (hdrs));
- g_free (hdrs);
+ mime_part->raw_headers_str = hdrs;
}
mime_part->type = type;
for (i = 0; i < task->parts->len; i ++) {
p = g_ptr_array_index (task->parts, i);
g_byte_array_free (p->content, TRUE);
+
+ if (p->raw_headers_str) {
+ g_free (p->raw_headers_str);
+ }
+
+ if (p->raw_headers) {
+ g_hash_table_unref (p->raw_headers);
+ }
}
for (i = 0; i < task->text_parts->len; i ++) {
tp = g_ptr_array_index (task->text_parts, i);
+
if (tp->normalized_words) {
g_array_free (tp->normalized_words, TRUE);
}