summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2009-03-24 13:29:52 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2009-03-24 13:29:52 +0300
commit5497b1213a5ee69cd25bd8cce26d223e8277ee3a (patch)
tree8a02b397f5b93194a73bc554c1fef6f37792ba58 /src
parentc9c29d4163deb873c9d66104639484e3a9ced2b1 (diff)
downloadrspamd-5497b1213a5ee69cd25bd8cce26d223e8277ee3a.tar.gz
rspamd-5497b1213a5ee69cd25bd8cce26d223e8277ee3a.zip
* Fix XS module to work with current type of memory allocation
Diffstat (limited to 'src')
-rw-r--r--src/message.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/message.c b/src/message.c
index fb0473b80..64467c827 100644
--- a/src/message.c
+++ b/src/message.c
@@ -592,7 +592,12 @@ local_message_get_header(memory_pool_t *pool, GMimeMessage *message, const char
h = GMIME_OBJECT(message)->headers->headers;
while (h) {
if (h->value && !g_strncasecmp (field, h->name, strlen (field))) {
- gret = g_list_prepend (gret, memory_pool_strdup (pool, h->value));
+ if (pool != NULL) {
+ gret = g_list_prepend (gret, memory_pool_strdup (pool, h->value));
+ }
+ else {
+ gret = g_list_prepend (gret, g_strdup (h->value));
+ }
}
h = h->next;
}
@@ -608,7 +613,13 @@ local_message_get_header(memory_pool_t *pool, GMimeMessage *message, const char
while (g_mime_header_iter_is_valid (iter)) {
name = g_mime_header_iter_get_name (iter);
if (!g_strncasecmp (field, name, strlen (name))) {
- gret = g_list_prepend (gret, memory_pool_strdup (pool, g_mime_header_iter_get_value (iter)));
+ if (pool != NULL) {
+ gret = g_list_prepend (gret, memory_pool_strdup (pool, g_mime_header_iter_get_value (iter)));
+ }
+ else {
+ gret = g_list_prepend (gret, g_strdup (g_mime_header_iter_get_value (iter)));
+ }
+ }
}
if (!g_mime_header_iter_next (iter)) {
break;
@@ -811,7 +822,12 @@ message_get_header (memory_pool_t *pool, GMimeMessage *message, const char *fiel
}
}
if (gret == NULL && ret != NULL) {
- gret = g_list_prepend (gret, memory_pool_strdup (pool, ret));
+ if (pool != NULL) {
+ gret = g_list_prepend (gret, memory_pool_strdup (pool, ret));
+ }
+ else {
+ gret = g_list_prepend (gret, g_strdup (ret));
+ }
}
if (fieldfunc[i].functype == FUNC_CHARFREEPTR && ret) {
g_free (ret);