Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4aec66e8 authored by Christopher Ferris's avatar Christopher Ferris
Browse files

Fix memory leak in UnwinderFromPid object.

Actually make the destructor virtual so that objects in
UnwinderFromPid get freed.

Also, explicitly make the DexFiles and JitDebug destructors virtual.

Bug: 123099840

Test: Ran UnwindTest.local_from_pid thousands of times.
Change-Id: I8bf11c0eb3587fa82f5f14f4723ea5c91da0fd46
parent a5e0d695
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ class DexFiles : public Global {
 public:
  explicit DexFiles(std::shared_ptr<Memory>& memory);
  DexFiles(std::shared_ptr<Memory>& memory, std::vector<std::string>& search_libs);
  ~DexFiles();
  virtual ~DexFiles();

  DexFile* GetDexFile(uint64_t dex_file_offset, MapInfo* info);

+1 −1
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ class JitDebug : public Global {
 public:
  explicit JitDebug(std::shared_ptr<Memory>& memory);
  JitDebug(std::shared_ptr<Memory>& memory, std::vector<std::string>& search_libs);
  ~JitDebug();
  virtual ~JitDebug();

  Elf* GetElf(Maps* maps, uint64_t pc);

+2 −2
Original line number Diff line number Diff line
@@ -72,7 +72,7 @@ class Unwinder {
    frames_.reserve(max_frames);
  }

  ~Unwinder() = default;
  virtual ~Unwinder() = default;

  void Unwind(const std::vector<std::string>* initial_map_names_to_skip = nullptr,
              const std::vector<std::string>* map_suffixes_to_ignore = nullptr);
@@ -124,7 +124,7 @@ class Unwinder {
class UnwinderFromPid : public Unwinder {
 public:
  UnwinderFromPid(size_t max_frames, pid_t pid) : Unwinder(max_frames), pid_(pid) {}
  ~UnwinderFromPid() = default;
  virtual ~UnwinderFromPid() = default;

  bool Init(ArchEnum arch);