Reuse SIRT for C++ references

Change-Id: I8310e55da42f55f7ec60f6b17face436c77a979f
diff --git a/src/class_loader.cc b/src/class_loader.cc
index 94a212f..1623303 100644
--- a/src/class_loader.cc
+++ b/src/class_loader.cc
@@ -31,12 +31,12 @@
 // TODO: get global references for these
 Class* PathClassLoader::dalvik_system_PathClassLoader_ = NULL;
 
-const PathClassLoader* PathClassLoader::AllocCompileTime(std::vector<const DexFile*>& dex_files) {
+PathClassLoader* PathClassLoader::AllocCompileTime(std::vector<const DexFile*>& dex_files) {
   CHECK(!Runtime::Current()->IsStarted());
   DCHECK(dalvik_system_PathClassLoader_ != NULL);
-  PathClassLoader* p = down_cast<PathClassLoader*>(dalvik_system_PathClassLoader_->AllocObject());
-  SetCompileTimeClassPath(p, dex_files);
-  return p;
+  SirtRef<PathClassLoader> p(down_cast<PathClassLoader*>(dalvik_system_PathClassLoader_->AllocObject()));
+  SetCompileTimeClassPath(p.get(), dex_files);
+  return p.get();
 }
 
 void PathClassLoader::SetClass(Class* dalvik_system_PathClassLoader) {