Skip to content

Commit

Permalink
Fix leak-prone CustomData in stdMem interface. Use std::unique_ptr to
Browse files Browse the repository at this point in the history
give ownership of `CustomData` to `CustomRequest` and `CustomResponse`
classes.
  • Loading branch information
bwhitchurch committed Oct 3, 2023
1 parent fd63753 commit 560ff3b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/sst/core/interfaces/stdMem.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<CustomData> data; /* Custom class that holds data for this event */
Addr iPtr; /* Instruction pointer */
uint32_t tid; /* Thread ID */
};

class CustomResp : public Request
Expand Down Expand Up @@ -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<CustomData> data; /* Custom class that holds data for this event */
Addr iPtr; /* Instruction pointer */
uint32_t tid; /* Thread ID */
};

/* Class for implementation-specific converter functions */
Expand Down

0 comments on commit 560ff3b

Please sign in to comment.