From 73afb1e7288305dcf7caaf13ad56aabcaa9290fc Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sat, 8 Oct 2011 12:47:42 +0000 Subject: Use malloc, memcpy instead of strdup since we have the length. svn path=/trunk/netsurf/; revision=13006 --- content/fetchers/data.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'content/fetchers/data.c') diff --git a/content/fetchers/data.c b/content/fetchers/data.c index 802b4f15e..68f59a792 100644 --- a/content/fetchers/data.c +++ b/content/fetchers/data.c @@ -86,13 +86,14 @@ static void *fetch_data_setup(struct fetch *parent_fetch, nsurl *url, return NULL; ctx->parent_fetch = parent_fetch; + /* TODO: keep as nsurl to avoid copy */ - ctx->url = strdup(nsurl_access(url)); - + ctx->url = malloc(nsurl_length(url) + 1); if (ctx->url == NULL) { free(ctx); return NULL; } + memcpy(ctx->url, nsurl_access(url), nsurl_length(url) + 1); RING_INSERT(ring, ctx); -- cgit v1.2.3