Bug 972593, part 2 - Don't deref an always-null pointer in nsStreamConverterService::FindConverter. r=mcmanus
authorMark Banner <standard8@mozilla.com>
Fri, 02 May 2014 16:12:32 +0100
changeset 181760 865805d83d5a677c901b8cec312ad8e40fce3150
parent 181759 d74ecd0b08ba4ba39220062dd9ac6a1066261a27
child 181761 a0424bca48cc3bfb3f50be8054b61a1d53ff0fc5
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewersmcmanus
bugs972593
milestone32.0a1
Bug 972593, part 2 - Don't deref an always-null pointer in nsStreamConverterService::FindConverter. r=mcmanus
netwerk/streamconv/src/nsStreamConverterService.cpp
--- a/netwerk/streamconv/src/nsStreamConverterService.cpp
+++ b/netwerk/streamconv/src/nsStreamConverterService.cpp
@@ -264,20 +264,18 @@ nsStreamConverterService::FindConverter(
         // reachable vertex in the loop.
         BFSTableData *headVertexState = lBFSTable.Get(*currentHead);
         if (!headVertexState) return NS_ERROR_FAILURE;
 
         int32_t edgeCount = data2->Count();
 
         for (int32_t i = 0; i < edgeCount; i++) {
             nsIAtom* curVertexAtom = data2->ObjectAt(i);
-            nsAutoString curVertexStr;
-            curVertexAtom->ToString(curVertexStr);
-            nsCString *curVertex = nullptr;
-            CopyUTF16toUTF8(curVertexStr, *curVertex);
+            nsCString *curVertex = new nsCString();
+            curVertexAtom->ToUTF8String(*curVertex);
 
             BFSTableData *curVertexState = lBFSTable.Get(*curVertex);
             if (!curVertexState) {
                 delete curVertex;
                 return NS_ERROR_FAILURE;
             }
 
             if (white == curVertexState->color) {