Return Build ID by const reference.

Bug: 169842943
Change-Id: Ie8ea4bf4cdd34d76a5135402e59a1a39001e6b9a
diff --git a/libunwindstack/MapInfo.cpp b/libunwindstack/MapInfo.cpp
index 559bc95..64ae44b 100644
--- a/libunwindstack/MapInfo.cpp
+++ b/libunwindstack/MapInfo.cpp
@@ -320,7 +320,7 @@
   }
 }
 
-std::string MapInfo::GetBuildID() {
+const std::string& MapInfo::GetBuildID() {
   uintptr_t id = build_id.load();
   if (id != 0) {
     return *reinterpret_cast<std::string*>(id);
diff --git a/libunwindstack/include/unwindstack/MapInfo.h b/libunwindstack/include/unwindstack/MapInfo.h
index 0a5ef11..a7705f8 100644
--- a/libunwindstack/include/unwindstack/MapInfo.h
+++ b/libunwindstack/include/unwindstack/MapInfo.h
@@ -109,7 +109,7 @@
   bool GetFunctionName(uint64_t addr, std::string* name, uint64_t* func_offset);
 
   // Returns the raw build id read from the elf data.
-  std::string GetBuildID();
+  const std::string& GetBuildID();
 
   // Returns the printable version of the build id (hex dump of raw data).
   std::string GetPrintableBuildID();