bug 236351 : Fix string leak in nsSOAPCall::GetTransport() r+sr=jst

This commit is contained in:
hpradhan%hotpop.com 2004-03-04 08:13:09 +00:00
parent 6a9b4c1c76
commit 5d5432d268

View File

@ -97,30 +97,23 @@ NS_IMETHODIMP nsSOAPCall::SetTransportURI(const nsAString & aTransportURI)
nsresult nsSOAPCall::GetTransport(nsISOAPTransport ** aTransport) nsresult nsSOAPCall::GetTransport(nsISOAPTransport ** aTransport)
{ {
NS_ENSURE_ARG_POINTER(aTransport); NS_ENSURE_ARG_POINTER(aTransport);
*aTransport = nsnull;
nsresult rv; nsresult rv;
nsCOMPtr < nsIURI > uri; nsCOMPtr < nsIURI > uri;
nsCAutoString protocol;
nsCString transportURI(ToNewCString(mTransportURI));
rv = NS_NewURI(getter_AddRefs(uri), transportURI.get()); rv = NS_NewURI(getter_AddRefs(uri), mTransportURI);
if (NS_FAILED(rv)) if (NS_FAILED(rv))
return rv; return rv;
nsCAutoString protocol;
uri->GetScheme(protocol); uri->GetScheme(protocol);
nsCAutoString transportContractid; nsCAutoString transportContractid;
transportContractid.Assign(NS_SOAPTRANSPORT_CONTRACTID_PREFIX); transportContractid.Assign(NS_SOAPTRANSPORT_CONTRACTID_PREFIX);
transportContractid.Append(protocol); transportContractid.Append(protocol);
nsCOMPtr < nsISOAPTransport > transport = return CallGetService(transportContractid.get(), aTransport);
do_GetService(transportContractid.get(), &rv);
if (NS_FAILED(rv))
return rv;
*aTransport = transport.get();
NS_ADDREF(*aTransport);
return NS_OK;
} }
/* nsISOAPResponse invoke (); */ /* nsISOAPResponse invoke (); */