From 7d5915b74791f87790e8e6da76c1f7ee400a97c0 Mon Sep 17 00:00:00 2001 From: "rogerl%netscape.com" Date: Thu, 15 Jul 1999 23:37:05 +0000 Subject: [PATCH] Fixed compile time errors + minor memory allocation problems. --- js/src/jsexn.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/js/src/jsexn.c b/js/src/jsexn.c index 1909f8cec80..53b9e739f05 100644 --- a/js/src/jsexn.c +++ b/js/src/jsexn.c @@ -20,6 +20,7 @@ * JS standard exception implementation. */ +#include #include "jsstddef.h" #include "jstypes.h" #include "jsutil.h" /* Added by JSIFY */ @@ -104,10 +105,10 @@ exn_initPrivate(JSContext *cx, JSErrorReport *report) report->uclinebuf); } else newReport->uclinebuf = newReport->uctokenptr = NULL; - + if (report->ucmessage != NULL) { jsint len = js_strlen(report->ucmessage) + 1; - newReport->ucmessage = (const jschar *)JS_malloc(cx, len); + newReport->ucmessage = (const jschar *)JS_malloc(cx, len * sizeof(jschar)); js_strncpy((jschar *)newReport->ucmessage, report->ucmessage, len); if (report->messageArgs) { @@ -125,9 +126,9 @@ exn_initPrivate(JSContext *cx, JSErrorReport *report) js_strncpy((jschar *)(newReport->messageArgs[i]), report->messageArgs[i], len); } - report->messageArgs[i] = NULL; + newReport->messageArgs[i] = NULL; } else { - report->messageArgs = NULL; + newReport->messageArgs = NULL; } } else { newReport->ucmessage = NULL;