Make sure that OfflineCompilationInfo is set to nullptr when needed.

Local variables weren't initialized when in tests and the early
return in ProcessProfiles didn't make sure that the output
parameter is set to nullptr.

Bug: 26080105
Change-Id: Id88a6abb515c3ab9a6ebac56bc9dac7920c3d58f
diff --git a/compiler/profile_assistant.cc b/compiler/profile_assistant.cc
index 0871722..85335ef 100644
--- a/compiler/profile_assistant.cc
+++ b/compiler/profile_assistant.cc
@@ -31,6 +31,7 @@
   DCHECK(!profile_files.empty());
   DCHECK(!reference_profile_files.empty() ||
       (profile_files.size() == reference_profile_files.size()));
+
   std::vector<ProfileCompilationInfo> new_info(profile_files.size());
   bool should_compile = false;
   // Read the main profile files.
@@ -44,7 +45,6 @@
   }
 
   if (!should_compile) {
-    *profile_compilation_info = nullptr;
     return true;
   }
 
@@ -124,6 +124,8 @@
         const std::vector<uint32_t>& profile_files_fd,
         const std::vector<uint32_t>& reference_profile_files_fd,
         /*out*/ ProfileCompilationInfo** profile_compilation_info) {
+  *profile_compilation_info = nullptr;
+
   std::string error;
   ScopedCollectionFlock profile_files_flocks(profile_files_fd.size());
   if (!profile_files_flocks.Init(profile_files_fd, &error)) {
@@ -145,6 +147,8 @@
         const std::vector<std::string>& profile_files,
         const std::vector<std::string>& reference_profile_files,
         /*out*/ ProfileCompilationInfo** profile_compilation_info) {
+  *profile_compilation_info = nullptr;
+
   std::string error;
   ScopedCollectionFlock profile_files_flocks(profile_files.size());
   if (!profile_files_flocks.Init(profile_files, &error)) {
diff --git a/compiler/profile_assistant_test.cc b/compiler/profile_assistant_test.cc
index cecb865..58b7513 100644
--- a/compiler/profile_assistant_test.cc
+++ b/compiler/profile_assistant_test.cc
@@ -180,7 +180,7 @@
   SetupProfile("p2", 2, kNumberOfMethodsToSkipCompilation, profile2, &info2);
 
   // We should not advise compilation.
-  ProfileCompilationInfo* result;
+  ProfileCompilationInfo* result = nullptr;
   ASSERT_TRUE(ProfileAssistant::ProcessProfiles(profile_fds, reference_profile_fds, &result));
   ASSERT_TRUE(result == nullptr);
 
@@ -221,7 +221,7 @@
   SetupProfile("p1", 2, kNumberOfMethodsToEnableCompilation, profile2, &info2);
 
   // We should fail processing.
-  ProfileCompilationInfo* result;
+  ProfileCompilationInfo* result = nullptr;
   ASSERT_FALSE(ProfileAssistant::ProcessProfiles(profile_fds, reference_profile_fds, &result));
   ASSERT_TRUE(result == nullptr);
 
@@ -258,7 +258,7 @@
   SetupProfile("p1", 2, kNumberOfMethodsToEnableCompilation, reference_profile, &reference_info);
 
   // We should not advise compilation.
-  ProfileCompilationInfo* result;
+  ProfileCompilationInfo* result = nullptr;
   ASSERT_TRUE(profile1.GetFile()->ResetOffset());
   ASSERT_TRUE(reference_profile.GetFile()->ResetOffset());
   ASSERT_FALSE(ProfileAssistant::ProcessProfiles(profile_fds, reference_profile_fds, &result));