mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-23 04:26:50 +03:00
data url handling: avoid needless allocation / copy.
This commit is contained in:
parent
c76b5ef4d5
commit
47e47244a9
@ -216,21 +216,12 @@ static bool fetch_data_process(struct fetch_data_context *c)
|
||||
free(unescaped);
|
||||
return false;
|
||||
}
|
||||
free(unescaped);
|
||||
} else {
|
||||
c->data = malloc(unescaped_len);
|
||||
if (c->data == NULL) {
|
||||
msg.type = FETCH_ERROR;
|
||||
msg.data.error =
|
||||
"Unable to allocate memory for data: URL";
|
||||
fetch_data_send_callback(&msg, c);
|
||||
free(unescaped);
|
||||
return false;
|
||||
}
|
||||
c->datalen = unescaped_len;
|
||||
memcpy(c->data, unescaped, unescaped_len);
|
||||
c->data = unescaped;
|
||||
}
|
||||
|
||||
free(unescaped);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user