mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 777083 - Don't leak when ownSource is true. r=luke
This commit is contained in:
parent
1ad7b84973
commit
3abd48772d
@ -1183,12 +1183,14 @@ ScriptSource::createFromSource(JSContext *cx, const jschar *src, uint32_t length
|
||||
ScriptSource *ss = static_cast<ScriptSource *>(cx->malloc_(sizeof(*ss)));
|
||||
if (!ss)
|
||||
return NULL;
|
||||
if (!ownSource) {
|
||||
const size_t memlen = length * sizeof(jschar);
|
||||
ss->data.compressed = static_cast<unsigned char *>(cx->malloc_(memlen));
|
||||
if (!ss->data.compressed) {
|
||||
cx->free_(ss);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
ss->next = NULL;
|
||||
ss->length_ = length;
|
||||
ss->compressedLength = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user