Skip to content
Snippets Groups Projects
Commit 63637963 authored by deuce's avatar deuce
Browse files

Use malloc() instead of alloca() so that we can use insanely long lines

in the web interface stuff to "unwrap" messages.
parent 365e202f
No related branches found
No related tags found
No related merge requests found
......@@ -830,12 +830,14 @@ js_word_wrap(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
if(argc>3 && JSVAL_IS_BOOLEAN(argv[3]))
handle_quotes=JSVAL_TO_BOOLEAN(argv[3]);
if((linebuf=(char*)alloca((len*2)+2))==NULL) /* room for ^A codes ToDo: This isn't actually "enough" room */
if((linebuf=(char*)malloc((len*2)+2))==NULL) /* room for ^A codes ToDo: This isn't actually "enough" room */
return(JS_FALSE);
if(handle_quotes) {
if((prefix=(char *)alloca((len*2)+2))==NULL) /* room for ^A codes ToDo: This isn't actually "enough" room */
if((prefix=(char *)malloc((len*2)+2))==NULL) { /* room for ^A codes ToDo: This isn't actually "enough" room */
free(linebuf);
return(JS_FALSE);
}
prefix[0]=0;
}
......@@ -1041,6 +1043,8 @@ js_word_wrap(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
js_str = JS_NewStringCopyZ(cx, outbuf);
free(outbuf);
free(linebuf);
free(prefix);
if(js_str==NULL)
return(JS_FALSE);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment