Reworked Post data to avoid memory leaks...

git-svn-id: svn://10.0.0.236/trunk@4793 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rpotts 1998-07-01 11:18:39 +00:00
parent e80a02583e
commit 6fefbee45b

View File

@ -346,13 +346,20 @@ void nsForm::OnSubmit(nsIPresContext* aPresContext, nsIFrame* aFrame,
NS_IF_RELEASE(docURL);
// Now pass on absolute url to the click handler
nsIPostData* postData = nsnull;
if (isPost) {
nsPostData postData(!isURLEncoded, data.ToNewCString());
handler->OnLinkClick(aFrame, absURLSpec, target, &postData);
}
else {
handler->OnLinkClick(aFrame, absURLSpec, target, nsnull);
nsresult rv;
char* postBuffer = data.ToNewCString();
rv = NS_NewPostData(!isURLEncoded, postBuffer, &postData);
if (NS_OK != rv) {
delete [] postBuffer;
}
/* The postBuffer is now owned by the IPostData instance */
}
handler->OnLinkClick(aFrame, absURLSpec, target, postData);
NS_IF_RELEASE(postData);
DebugPrint("url", absURLSpec);
DebugPrint("data", data);