1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-04 08:17:17 -05:00

Comment the last change

This commit is contained in:
Miciah Dashiel Butler Masters 2009-02-25 01:54:16 +00:00
parent f11b2a8f97
commit e9370fe5b9

View File

@ -205,8 +205,8 @@ utf8_to_jsstring(JSContext *ctx, const unsigned char *str, int length)
return NULL; return NULL;
} }
utf16_alloc = in_bytes; utf16_alloc = in_bytes;
/* Don't use fmem_alloc here because long strings could /* Use malloc because SpiderMonkey will handle the memory after
* exhaust the stack. */ * this routine finishes. */
utf16 = malloc(utf16_alloc * sizeof(jschar)); utf16 = malloc(utf16_alloc * sizeof(jschar));
if (utf16 == NULL) { if (utf16 == NULL) {
JS_ReportOutOfMemory(ctx); JS_ReportOutOfMemory(ctx);
@ -236,6 +236,8 @@ utf8_to_jsstring(JSContext *ctx, const unsigned char *str, int length)
} }
jsstr = JS_NewUCString(ctx, utf16, utf16_used); jsstr = JS_NewUCString(ctx, utf16, utf16_used);
/* Do not free if JS_NewUCString was successful because it takes over
* handling of the memory. */
if (jsstr == NULL) free(utf16); if (jsstr == NULL) free(utf16);
return jsstr; return jsstr;