Bug 1026656 - Fix resolve accessing temporary variable. r=valentin.gosu, r=mcmanus
authorNicu Badescu <badescunicu@yahoo.com>
Sun, 22 Jun 2014 15:55:00 -0400
changeset 190908 9f8a077acb66b8cd9249a71277c7b8b49df1c556
parent 190907 7f10a0e42e895d8a66920ac8b076d81b61a5a562
child 190909 72f554d3e1c89ce66d0f7b8025bb93030f306f57
push id45437
push userryanvm@gmail.com
push dateThu, 26 Jun 2014 12:59:47 +0000
treeherdermozilla-inbound@72f554d3e1c8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvalentin.gosu, mcmanus
bugs1026656
milestone33.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1026656 - Fix resolve accessing temporary variable. r=valentin.gosu, r=mcmanus
netwerk/dns/nsDNSService2.cpp
--- a/netwerk/dns/nsDNSService2.cpp
+++ b/netwerk/dns/nsDNSService2.cpp
@@ -671,18 +671,19 @@ nsDNSService::AsyncResolve(const nsACStr
     if (!res)
         return NS_ERROR_OFFLINE;
 
     if (mOffline)
         flags |= RESOLVE_OFFLINE;
 
     const nsACString *hostPtr = &hostname;
 
+    nsAutoCString strLocalhost(NS_LITERAL_CSTRING("localhost"));
     if (localDomain) {
-        hostPtr = &(NS_LITERAL_CSTRING("localhost"));
+        hostPtr = &strLocalhost;
     }
 
     nsresult rv;
     nsAutoCString hostACE;
     if (idn && !IsASCII(*hostPtr)) {
         if (NS_SUCCEEDED(idn->ConvertUTF8toACE(*hostPtr, hostACE)))
             hostPtr = &hostACE;
     }
@@ -780,18 +781,19 @@ nsDNSService::Resolve(const nsACString &
 
     NS_ENSURE_TRUE(res, NS_ERROR_OFFLINE);
 
     if (mOffline)
         flags |= RESOLVE_OFFLINE;
 
     const nsACString *hostPtr = &hostname;
 
+    nsAutoCString strLocalhost(NS_LITERAL_CSTRING("localhost"));
     if (localDomain) {
-        hostPtr = &(NS_LITERAL_CSTRING("localhost"));
+        hostPtr = &strLocalhost;
     }
 
     nsresult rv;
     nsAutoCString hostACE;
     if (idn && !IsASCII(*hostPtr)) {
         if (NS_SUCCEEDED(idn->ConvertUTF8toACE(*hostPtr, hostACE)))
             hostPtr = &hostACE;
     }