Bug 849456 - Fix a potential NULL deref on OOM. r=mrosenberg

This commit is contained in:
Terrence Cole 2013-03-08 17:44:09 -08:00
Родитель 1e1680f215
Коммит 611c1b675e
1 изменённых файлов: 2 добавлений и 0 удалений

Просмотреть файл

@ -152,6 +152,8 @@ JS::TwoByteCharsToNewUTF8CharsZ(JSContext *cx, TwoByteChars tbchars)
/* Allocate buffer. */
unsigned char *utf8 = cx->pod_malloc<unsigned char>(len + 1);
if (!utf8)
return UTF8CharsZ();
/* Encode to UTF8. */
DeflateStringToUTF8Buffer(cx, str, tbchars.length(), (char *)utf8, &len);