From 7dbf76d0da5c78b8e987ce3fe1bf25781b02b82e Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Mon, 9 Oct 2017 16:46:42 +0100 Subject: Fix an object lifetime bug in net load tests The commands handler must not be destroyed before the config object, or we'll be accessing freed memory. An earlier attempt at using boost::shared_ptr to control object lifetime turned out to be very invasive, though would be a better solution in theory. --- contrib/epee/tests/src/net/test_net.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'contrib/epee/tests') diff --git a/contrib/epee/tests/src/net/test_net.h b/contrib/epee/tests/src/net/test_net.h index 5b21036bb..2e1b1e5fd 100644 --- a/contrib/epee/tests/src/net/test_net.h +++ b/contrib/epee/tests/src/net/test_net.h @@ -155,7 +155,7 @@ namespace tests bool init(const std::string& bind_port = "", const std::string& bind_ip = "0.0.0.0") { - m_net_server.get_config_object().m_pcommands_handler = this; + m_net_server.get_config_object().set_handler(this); m_net_server.get_config_object().m_invoke_timeout = 1000; LOG_PRINT_L0("Binding on " << bind_ip << ":" << bind_port); return m_net_server.init_server(bind_port, bind_ip); -- cgit v1.2.3