diff --git a/lib/Analysis/IPA/CallGraph.cpp b/lib/Analysis/IPA/CallGraph.cpp index c59c31c22a9..62a4c31e3bd 100644 --- a/lib/Analysis/IPA/CallGraph.cpp +++ b/lib/Analysis/IPA/CallGraph.cpp @@ -158,9 +158,11 @@ private: // destroy - Release memory for the call graph virtual void destroy() { /// CallsExternalNode is not in the function map, delete it explicitly. - CallsExternalNode->allReferencesDropped(); - delete CallsExternalNode; - CallsExternalNode = 0; + if (CallsExternalNode) { + CallsExternalNode->allReferencesDropped(); + delete CallsExternalNode; + CallsExternalNode = 0; + } CallGraph::destroy(); } };