Stop TestInfo::Run() calling a function through null pointer
If the object was never created then trying to call &Test::DeleteSelf_ will dereference a null pointer, with undefined behaviour. Fixes #845
This commit is contained in:
		
				
					committed by
					
						
						Knut Omang
					
				
			
			
				
	
			
			
			
						parent
						
							9a502a5b14
						
					
				
				
					commit
					48e6f1f387
				
			@@ -2675,10 +2675,12 @@ void TestInfo::Run() {
 | 
			
		||||
    test->Run();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (test != NULL) {
 | 
			
		||||
    // Deletes the test object.
 | 
			
		||||
    impl->os_stack_trace_getter()->UponLeavingGTest();
 | 
			
		||||
    internal::HandleExceptionsInMethodIfSupported(
 | 
			
		||||
        test, &Test::DeleteSelf_, "the test fixture's destructor");
 | 
			
		||||
	test, &Test::DeleteSelf_, "the test fixture's destructor");
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  result_.set_elapsed_time(internal::GetTimeInMillis() - start);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user