From 560ff3b6b0d9072ae267d827e4242e20801ab432 Mon Sep 17 00:00:00 2001 From: Brandon Michael Whitchurch Date: Tue, 3 Oct 2023 09:40:10 -0700 Subject: [PATCH] Fix leak-prone CustomData in stdMem interface. Use `std::unique_ptr` to give ownership of `CustomData` to `CustomRequest` and `CustomResponse` classes. --- src/sst/core/interfaces/stdMem.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/sst/core/interfaces/stdMem.h b/src/sst/core/interfaces/stdMem.h index fd43bec4e..b2227e7a3 100644 --- a/src/sst/core/interfaces/stdMem.h +++ b/src/sst/core/interfaces/stdMem.h @@ -913,9 +913,9 @@ class StandardMem : public SubComponent return str.str(); } - CustomData* data; /* Custom class that holds data for this event */ - Addr iPtr; /* Instruction pointer */ - uint32_t tid; /* Thread ID */ + std::unique_ptr data; /* Custom class that holds data for this event */ + Addr iPtr; /* Instruction pointer */ + uint32_t tid; /* Thread ID */ }; class CustomResp : public Request @@ -951,9 +951,9 @@ class StandardMem : public SubComponent return str.str(); } - CustomData* data; /* Custom class that holds data for this event */ - Addr iPtr; /* Instruction pointer */ - uint32_t tid; /* Thread ID */ + std::unique_ptr data; /* Custom class that holds data for this event */ + Addr iPtr; /* Instruction pointer */ + uint32_t tid; /* Thread ID */ }; /* Class for implementation-specific converter functions */