When I compare this with the fix that I did as part of ticket [#2451] (pasted
in below), I think it looks like you forgot free(ms), and thus you get a memory
leak eachh time you receive an CLMSV_CLMS_TO_CLMNA_REBOOT_MSG,
CLMSV_CLMS_TO_CLMNA_NODE_REBOOT_MSG or CLMSV_CLMS_TO_CLMNA_ACTION_MSG message?
Also, maybe you should consider using a switch statement like I did? Ack for
the patch if you at least fix the memory leak.
You find my patch below (though cluster_generation_id is of course not
applicable without the rest of the code in ticket [#2451].
@@ -175,15 +247,40 @@ static uint32_t clmna_mds_dec_flat(struct
ncsmds_callback_info *info)
static uint32_t clmna_mds_rcv(struct ncsmds_callback_info *mds_cb_info)
{
CLMSV_MSG *msg = (CLMSV_MSG *)mds_cb_info->info.receive.i_msg;
- CLMNA_EVT *evt = calloc(1, sizeof(CLMNA_EVT));
- evt->type = CLMNA_EVT_JOIN_RESPONSE;
- evt->join_response.rc = msg->info.api_resp_info.rc;
- evt->join_response.node_name = msg->info.api_resp_info.param.node_name;
- free(msg);
- if (m_NCS_IPC_SEND(&clmna_cb->mbx, evt, NCS_IPC_PRIORITY_VERY_HIGH) !=
- NCSCC_RC_SUCCESS) {
- LOG_ER("IPC send to mailbox failed: %s", __FUNCTION__);
+
+ switch (msg->evt_type) {
+ case CLMSV_CLMS_TO_CLMNA_REBOOT_MSG:
+ break;
+ case CLMSV_CLMS_TO_CLMA_API_RESP_MSG: {
+ CLMNA_EVT *evt = calloc(1, sizeof(CLMNA_EVT));
+
+ if (msg->info.api_resp_info.type == CLMSV_CLUSTER_JOIN_RESP) {
+ evt->type = CLMNA_EVT_JOIN_RESPONSE;
+ evt->join_response.rc = msg->info.api_resp_info.rc;
+ evt->join_response.node_name =
+ msg->info.api_resp_info.param.join_response
+ .node_name;
+ evt->join_response.cluster_generation_id =
+ msg->info.api_resp_info.param.join_response
+ .cluster_generation_id;
+ TRACE("join_response.cluster_generation_id = %" PRIu64,
+ evt->join_response.cluster_generation_id);
+ if (m_NCS_IPC_SEND(&clmna_cb->mbx, evt,
+ NCS_IPC_PRIORITY_VERY_HIGH) !=
+ NCSCC_RC_SUCCESS) {
+ LOG_ER("IPC send to mailbox failed: %s",
+ __FUNCTION__);
+ }
+ } else {
+ LOG_ER("Unknown API response type %d",
+ msg->info.api_resp_info.type);
+ }
+ } break;
+ default:
+ LOG_ER("Unknown event type %d", msg->evt_type);
+ break;
}
+ free(msg);
return NCSCC_RC_SUCCESS;
}
On 11/01/2017 04:23 PM, Hans Nordeback wrote:
---
src/clm/clmnd/main.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/clm/clmnd/main.c b/src/clm/clmnd/main.c
index 926c5b718..948703426 100644
--- a/src/clm/clmnd/main.c
+++ b/src/clm/clmnd/main.c
@@ -215,6 +215,13 @@ static uint32_t clmna_mds_dec_flat(struct
ncsmds_callback_info *info)
static uint32_t clmna_mds_rcv(struct ncsmds_callback_info *mds_cb_info)
{
CLMSV_MSG *msg = (CLMSV_MSG *)mds_cb_info->info.receive.i_msg;
+
+ if (msg->evt_type == CLMSV_CLMS_TO_CLMNA_REBOOT_MSG ||
+ msg->evt_type == CLMSV_CLMS_TO_CLMNA_NODE_REBOOT_MSG ||
+ msg->evt_type == CLMSV_CLMS_TO_CLMNA_ACTION_MSG) {
+ return NCSCC_RC_SUCCESS;
+ }
+
CLMNA_EVT *evt = calloc(1, sizeof(CLMNA_EVT));
evt->type = CLMNA_EVT_JOIN_RESPONSE;
evt->join_response.rc = msg->info.api_resp_info.rc;
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel