diff --git a/dom/src/base/nsLocation.cpp b/dom/src/base/nsLocation.cpp index 02122198fdfb..8820e34ef1a1 100644 --- a/dom/src/base/nsLocation.cpp +++ b/dom/src/base/nsLocation.cpp @@ -151,7 +151,7 @@ LocationImpl::SetHash(const nsString& aHash) char *buf = aHash.ToNewCString(); url->SetRef(buf); SetURL(url); - delete buf; + delete[] buf; NS_IF_RELEASE(url); } } @@ -202,7 +202,7 @@ LocationImpl::SetHost(const nsString& aHost) char *buf = aHost.ToNewCString(); url->SetHost(buf); SetURL(url); - delete buf; + delete[] buf; NS_IF_RELEASE(url); } } @@ -246,7 +246,7 @@ LocationImpl::SetHostname(const nsString& aHostname) char *buf = aHostname.ToNewCString(); url->SetHost(buf); SetURL(url); - delete buf; + delete[] buf; NS_IF_RELEASE(url); } } @@ -335,7 +335,7 @@ LocationImpl::SetPathname(const nsString& aPathname) char *buf = aPathname.ToNewCString(); url->SetFile(buf); SetURL(url); - delete buf; + delete[] buf; NS_IF_RELEASE(url); } } @@ -391,7 +391,7 @@ LocationImpl::SetPort(const nsString& aPort) } url->SetHostPort(port); SetURL(url); - delete buf; + delete[] buf; NS_IF_RELEASE(url); } } @@ -437,7 +437,7 @@ LocationImpl::SetProtocol(const nsString& aProtocol) char *buf = aProtocol.ToNewCString(); url->SetProtocol(buf); SetURL(url); - delete buf; + delete[] buf; NS_IF_RELEASE(url); } } @@ -486,7 +486,7 @@ LocationImpl::SetSearch(const nsString& aSearch) char *buf = aSearch.ToNewCString(); url->SetSearch(buf); SetURL(url); - delete buf; + delete[] buf; NS_IF_RELEASE(url); } } diff --git a/dom/src/build/nsDOMFactory.cpp b/dom/src/build/nsDOMFactory.cpp index 11f5a2810dd1..3362f1e78295 100644 --- a/dom/src/build/nsDOMFactory.cpp +++ b/dom/src/build/nsDOMFactory.cpp @@ -359,7 +359,7 @@ nsDOMScriptObjectFactory::NewScriptElement(const nsString &aTagName, nsDOMHTMLTag tag = NS_DOMTagToEnum(str); if (str) { - delete str; + delete[] str; } switch (tag) { diff --git a/dom/src/events/nsJSEventListener.cpp b/dom/src/events/nsJSEventListener.cpp index 6968f9543b6b..f968ae634579 100644 --- a/dom/src/events/nsJSEventListener.cpp +++ b/dom/src/events/nsJSEventListener.cpp @@ -78,11 +78,11 @@ nsresult nsJSEventListener::ProcessEvent(nsIDOMEvent* aEvent) mEventChars = mEventString.ToNewCString(); if (!JS_LookupProperty(mContext, mJSObj, mEventChars, &funval)) { - delete mEventChars; + delete[] mEventChars; return NS_ERROR_FAILURE; } - delete mEventChars; + delete[] mEventChars; if (JS_TypeOfValue(mContext, funval) != JSTYPE_FUNCTION) { return NS_OK;