mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-01-10 13:03:09 +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);
|
free(unescaped);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
free(unescaped);
|
||||||
} else {
|
} 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;
|
c->datalen = unescaped_len;
|
||||||
memcpy(c->data, unescaped, unescaped_len);
|
c->data = unescaped;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(unescaped);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user