versioner: fix leak.

Replace an intentional leak of a buffer allocated by realpath with a use
of android::base::Realpath.

Bug: http://b/37727515
Test: tools/versioner/run_tests.py
Change-Id: Ia7200bf0e1c485050e860e21ff15784941366bec
diff --git a/tools/versioner/src/versioner.cpp b/tools/versioner/src/versioner.cpp
index 59d41da..b551709 100644
--- a/tools/versioner/src/versioner.cpp
+++ b/tools/versioner/src/versioner.cpp
@@ -41,6 +41,7 @@
 
 #include <llvm/ADT/StringRef.h>
 
+#include <android-base/file.h>
 #include <android-base/macros.h>
 #include <android-base/parseint.h>
 
@@ -570,8 +571,9 @@
       platform_dir = versioner_dir + "/platforms";
     }
   } else {
-    // Intentional leak.
-    header_dir = realpath(argv[optind], nullptr);
+    if (!android::base::Realpath(argv[optind], &header_dir)) {
+      err(1, "failed to get realpath for path '%s'", argv[optind]);
+    }
 
     if (argc - optind == 2) {
       dependency_dir = argv[optind + 1];