mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-23 04:26:50 +03:00
Use malloc, memcpy instead of strdup since we have the length.
svn path=/trunk/netsurf/; revision=13006
This commit is contained in:
parent
c876a37a5f
commit
73afb1e728
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user