From 7205cb7f3949eeb988e2f5b3c82230b5a6950ca6 Mon Sep 17 00:00:00 2001 From: Roman Khlopkov <roman.khlopkov@demlabs.net> Date: Tue, 8 Aug 2023 17:45:02 +0300 Subject: [PATCH] [*] Segfault fix with ESBOCS loading --- dap-sdk | 2 +- modules/consensus/block-pos/dap_chain_cs_block_pos.c | 3 ++- modules/consensus/dag-pos/dap_chain_cs_dag_pos.c | 4 ++-- modules/consensus/esbocs/dap_chain_cs_esbocs.c | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/dap-sdk b/dap-sdk index c052ecc8c0..26f3dec199 160000 --- a/dap-sdk +++ b/dap-sdk @@ -1 +1 @@ -Subproject commit c052ecc8c04e336f65d73a9707515612103c81f2 +Subproject commit 26f3dec199f975c29b7b8c241c108065e18e16ee diff --git a/modules/consensus/block-pos/dap_chain_cs_block_pos.c b/modules/consensus/block-pos/dap_chain_cs_block_pos.c index 95b275c3f9..0d714ab4f1 100644 --- a/modules/consensus/block-pos/dap_chain_cs_block_pos.c +++ b/modules/consensus/block-pos/dap_chain_cs_block_pos.c @@ -94,8 +94,9 @@ static int s_callback_new(dap_chain_t *a_chain, dap_config_t *a_chain_cfg) l_blocks->callback_delete = s_callback_delete; l_blocks->callback_block_verify = s_callback_block_verify; l_blocks->callback_block_sign = s_callback_block_sign; + + l_pos->_pvt = DAP_NEW_Z(dap_chain_cs_block_pos_pvt_t); dap_chain_cs_block_pos_pvt_t *l_pos_pvt = PVT(l_pos); - l_pos_pvt = DAP_NEW_Z(dap_chain_cs_block_pos_pvt_t); if (!l_pos_pvt) { log_it(L_ERROR, "Memory allocation error in %s, line %d", __PRETTY_FUNCTION__, __LINE__); goto lb_err; diff --git a/modules/consensus/dag-pos/dap_chain_cs_dag_pos.c b/modules/consensus/dag-pos/dap_chain_cs_dag_pos.c index de2c3413c9..f315d7a2bc 100644 --- a/modules/consensus/dag-pos/dap_chain_cs_dag_pos.c +++ b/modules/consensus/dag-pos/dap_chain_cs_dag_pos.c @@ -86,7 +86,6 @@ static int s_callback_new(dap_chain_t * a_chain, dap_config_t * a_chain_cfg) log_it(L_ERROR, "Memory allocation error in %s, line %d", __PRETTY_FUNCTION__, __LINE__); return -1; } - dap_chain_cs_dag_pos_pvt_t * l_pos_pvt = PVT ( l_pos ); char ** l_tokens_hold = NULL; char ** l_tokens_hold_value_str = NULL; @@ -98,7 +97,8 @@ static int s_callback_new(dap_chain_t * a_chain, dap_config_t * a_chain_cfg) l_dag->callback_cs_verify = s_callback_event_verify; l_dag->callback_cs_event_create = s_callback_event_create; l_pos->_pvt = DAP_NEW_Z ( dap_chain_cs_dag_pos_pvt_t ); - if (!l_pos->_pvt) { + dap_chain_cs_dag_pos_pvt_t *l_pos_pvt = PVT(l_pos); + if (!l_pos_pvt) { log_it(L_ERROR, "Memory allocation error in %s, line %d", __PRETTY_FUNCTION__, __LINE__); goto lb_err; } diff --git a/modules/consensus/esbocs/dap_chain_cs_esbocs.c b/modules/consensus/esbocs/dap_chain_cs_esbocs.c index ae4aad566d..2e7e6cfbb3 100644 --- a/modules/consensus/esbocs/dap_chain_cs_esbocs.c +++ b/modules/consensus/esbocs/dap_chain_cs_esbocs.c @@ -180,8 +180,8 @@ static int s_callback_new(dap_chain_t *a_chain, dap_config_t *a_chain_cfg) a_chain->callback_get_minimum_fee = s_callback_get_minimum_fee; a_chain->callback_get_signing_certificate = s_callback_get_sign_key; + l_esbocs->_pvt = DAP_NEW_Z(dap_chain_esbocs_pvt_t); dap_chain_esbocs_pvt_t *l_esbocs_pvt = PVT(l_esbocs); - l_esbocs_pvt = DAP_NEW_Z(dap_chain_esbocs_pvt_t); if (!l_esbocs_pvt) { log_it(L_ERROR, "Memory allocation error in %s, line %d", __PRETTY_FUNCTION__, __LINE__); l_ret = - 5; -- GitLab