Skip to content

Commit

Permalink
reg_router: fix an issue in mod_addr_name_map
Browse files Browse the repository at this point in the history
- mod_addr_name_map member variable was defined as const& and this may trigger
a dangling reference problem.

Signed-off-by: Mahmoud Kamel <quic_mkamel@quicinc.com>
  • Loading branch information
Mahmoud Kamel committed Dec 4, 2024
1 parent 85f41a2 commit ae3e3ec
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions systemc-components/reg_router/include/reg_router.h
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,12 @@ class reg_router : public sc_core::sc_module, public gs::router_if<BUSWIDTH>
}

public:
explicit reg_router(const sc_core::sc_module_name& nm,
const std::map<uint64_t, std::pair<uint64_t, const char*>>& p_mod_addr_name_map = {},
const std::function<void(bool, uint64_t)>& pre_b_transport_callback = {},
cci::cci_broker_handle broker = cci::cci_get_broker())
explicit reg_router(
const sc_core::sc_module_name& nm,
const std::map<uint64_t, std::pair<uint64_t, const char*>>& p_mod_addr_name_map =
std::map<uint64_t, std::pair<uint64_t, const char*>>(),
const std::function<void(bool, uint64_t)>& pre_b_transport_callback = std::function<void(bool, uint64_t)>(),
cci::cci_broker_handle broker = cci::cci_get_broker())
: sc_core::sc_module(nm)
, initiator_socket("initiator_socket", [&](std::string s) -> void { register_boundto(s); })
, target_socket("target_socket")
Expand Down Expand Up @@ -338,7 +340,7 @@ class reg_router : public sc_core::sc_module, public gs::router_if<BUSWIDTH>
private:
std::vector<target_info*> mem_targets;
std::map<sc_dt::uint64, target_info*> cb_targets;
const std::map<uint64_t, std::pair<uint64_t, const char*>>& mod_addr_name_map;
std::map<uint64_t, std::pair<uint64_t, const char*>> mod_addr_name_map;
std::function<void(bool, uint64_t)> m_pre_b_transport_callback;
bool initialized = false;
};
Expand Down

0 comments on commit ae3e3ec

Please sign in to comment.