aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmime/mime_headers.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-04-08 10:09:36 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-04-08 10:09:51 +0100
commited963d568f42db5ada19b0f2777ace8f301a563d (patch)
treeb1ea70f4b42ab472e23b3af9b20af9129179ef82 /src/libmime/mime_headers.c
parent50e4a10338fea60efc20762949546c89a01bdd55 (diff)
downloadrspamd-ed963d568f42db5ada19b0f2777ace8f301a563d.tar.gz
rspamd-ed963d568f42db5ada19b0f2777ace8f301a563d.zip
[Minor] Use normal string allocation
Diffstat (limited to 'src/libmime/mime_headers.c')
-rw-r--r--src/libmime/mime_headers.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libmime/mime_headers.c b/src/libmime/mime_headers.c
index b333fcdfe..e44b14eaa 100644
--- a/src/libmime/mime_headers.c
+++ b/src/libmime/mime_headers.c
@@ -465,6 +465,7 @@ rspamd_mime_header_decode (rspamd_mempool_t *pool, const gchar *in,
gint encoding;
gssize r;
guint qmarks = 0;
+ gchar *ret;
enum {
parse_normal = 0,
got_eqsign,
@@ -478,9 +479,7 @@ rspamd_mime_header_decode (rspamd_mempool_t *pool, const gchar *in,
c = in;
p = in;
end = in + inlen;
- out = rspamd_mempool_alloc0 (pool, sizeof (*out));
- g_string_set_size (out, inlen);
- out->len = 0;
+ out = g_string_sized_new (inlen);
token = g_byte_array_sized_new (80);
decoded = g_byte_array_sized_new (122);
@@ -632,9 +631,10 @@ rspamd_mime_header_decode (rspamd_mempool_t *pool, const gchar *in,
g_byte_array_free (token, TRUE);
g_byte_array_free (decoded, TRUE);
- rspamd_mempool_add_destructor (pool, g_free, out->str);
+ ret = g_string_free (out, FALSE);
+ rspamd_mempool_add_destructor (pool, g_free, ret);
- return out->str;
+ return ret;
}
gchar *