Use malloc, memcpy instead of strdup since we have the length.

svn path=/trunk/netsurf/; revision=13006
This commit is contained in:
Michael Drake 2011-10-08 12:47:42 +00:00
parent c876a37a5f
commit 73afb1e728

View File

@ -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);