Explorar o código

Common: Don't return a reference to a string when calling GetName in symbols.cpp

Returning a copy of the string is what was likely meant to be done.
Lioncash %!s(int64=12) %!d(string=hai) anos
pai
achega
a49a5fa4d9
Modificáronse 2 ficheiros con 2 adicións e 2 borrados
  1. 1 1
      src/common/symbols.cpp
  2. 1 1
      src/common/symbols.h

+ 1 - 1
src/common/symbols.cpp

@@ -40,7 +40,7 @@ namespace Symbols
 
         return symbol;
     }
-    const std::string& GetName(u32 _address)
+    const std::string GetName(u32 _address)
     {
         return GetSymbol(_address).name;
     }

+ 1 - 1
src/common/symbols.h

@@ -32,7 +32,7 @@ namespace Symbols
 
     void Add(u32 _address, const std::string& _name, u32 _size, u32 _type);
     TSymbol GetSymbol(u32 _address);
-    const std::string& GetName(u32 _address);
+    const std::string GetName(u32 _address);
     void Remove(u32 _address);
     void Clear();
 };