bug 319264: Fix double-free reporting strict warnings about assigning to read-only properties. r=brendan

This commit is contained in:
mrbkap%gmail.com 2005-12-11 06:44:29 +00:00
parent 6f357ea298
commit d3eee0b215

View File

@ -1,4 +1,5 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: set ts=8 sw=4 et tw=80:
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
@ -1007,9 +1008,15 @@ js_ReportErrorNumberVA(JSContext *cx, uintN flags, JSErrorCallback callback,
if (message)
JS_free(cx, message);
if (report.messageArgs) {
int i = 0;
while (report.messageArgs[i])
JS_free(cx, (void *)report.messageArgs[i++]);
/*
* js_ExpandErrorArguments only owns its messageArgs if it had to
* inflate the arguments (from regular |char *|s).
*/
if (charArgs) {
int i = 0;
while (report.messageArgs[i])
JS_free(cx, (void *)report.messageArgs[i++]);
}
JS_free(cx, (void *)report.messageArgs);
}
if (report.ucmessage)