mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-01-09 12:32:21 +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;
|
return NULL;
|
||||||
|
|
||||||
ctx->parent_fetch = parent_fetch;
|
ctx->parent_fetch = parent_fetch;
|
||||||
|
|
||||||
/* TODO: keep as nsurl to avoid copy */
|
/* TODO: keep as nsurl to avoid copy */
|
||||||
ctx->url = strdup(nsurl_access(url));
|
ctx->url = malloc(nsurl_length(url) + 1);
|
||||||
|
|
||||||
if (ctx->url == NULL) {
|
if (ctx->url == NULL) {
|
||||||
free(ctx);
|
free(ctx);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
memcpy(ctx->url, nsurl_access(url), nsurl_length(url) + 1);
|
||||||
|
|
||||||
RING_INSERT(ring, ctx);
|
RING_INSERT(ring, ctx);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user