aboutsummaryrefslogtreecommitdiffstats
path: root/src/url.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2009-03-04 19:14:30 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2009-03-04 19:14:30 +0300
commit8c09632127fb53347239f5f35c0049d8d316a607 (patch)
tree0a1b7e772d655b5e3632d37e20d96a0ea3ad2e49 /src/url.c
parentb4e3c966595fb52ed7aacd8505d184376eaeaebb (diff)
downloadrspamd-8c09632127fb53347239f5f35c0049d8d316a607.tar.gz
rspamd-8c09632127fb53347239f5f35c0049d8d316a607.zip
* Fix bug in url parser with freeing memory allocated by memory_pool allocator
* Do not write to log if we don't do any read operation in dispatcher library
Diffstat (limited to 'src/url.c')
-rw-r--r--src/url.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/url.c b/src/url.c
index 09be6f112..31851c3bb 100644
--- a/src/url.c
+++ b/src/url.c
@@ -446,7 +446,7 @@ char_needs_escaping (const char *p)
*/
static char *
-reencode_escapes (const char *s, memory_pool_t *pool)
+reencode_escapes (char *s, memory_pool_t *pool)
{
const char *p1;
char *newstr, *p2;
@@ -462,7 +462,7 @@ reencode_escapes (const char *s, memory_pool_t *pool)
if (!encode_count) {
/* The string is good as it is. */
- return memory_pool_strdup (pool, s);
+ return s;
}
oldlen = p1 - s;
@@ -620,8 +620,8 @@ parse_uri(struct uri *uri, unsigned char *uristring, memory_pool_t *pool)
/* Assume http as default protocol */
if (!uri->protocollen || (uri->protocol = get_protocol (struri(uri), uri->protocollen)) == PROTOCOL_UNKNOWN) {
p = g_strconcat ("http://", uri->string, NULL);
- g_free (uri->string);
- uri->string = p;
+ uri->string = memory_pool_strdup (pool, p);
+ g_free (p);
uri->protocol = PROTOCOL_HTTP;
prefix_end = struri (uri) + 7;
}