Fixed memory management issues
This commit is contained in:
@@ -396,6 +396,9 @@ boolean_t pdcp_data_req(
|
||||
|
||||
proto_agent_send_rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p);
|
||||
//rlc_status = ack_result;
|
||||
// free the memory for this block
|
||||
free_mem_block(pdcp_pdu_p);
|
||||
|
||||
printf("Response is %u\n", ack_result_nikos);
|
||||
rlc_status = ack_result_nikos;
|
||||
}
|
||||
@@ -454,18 +457,6 @@ boolean_t pdcp_data_req(
|
||||
}
|
||||
}*/
|
||||
|
||||
//starting async
|
||||
// const Enb_properties_array_t *enb_properties_p = NULL;
|
||||
// Enb_properties_array_t *enb_properties_p = NULL;
|
||||
// enb_properties_p = malloc(sizeof(Enb_properties_array_t));
|
||||
// memset(enb_properties_p, 0, sizeof(Enb_properties_array_t));
|
||||
// printf("starting the client\n\n");
|
||||
|
||||
// printf("Starting the async client\\n");
|
||||
// new_thread(proto_server_start, NULL);
|
||||
// enb_properties_p = enb_config_get();
|
||||
|
||||
// proto_agent_start(ctxt_pP->module_id, enb_properties_p);
|
||||
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_REQ,VCD_FUNCTION_OUT);
|
||||
|
||||
@@ -86,7 +86,7 @@ void *receive_thread(void *args) {
|
||||
LOG_E(PROTO_AGENT,"msg to send back is NULL\n");
|
||||
}
|
||||
|
||||
free(data);
|
||||
//free(data);
|
||||
|
||||
if (msg != NULL){
|
||||
if (proto_agent_msg_send(d->enb_id, PROTO_AGENT_DEFAULT, msg, size, priority)) {
|
||||
@@ -373,12 +373,10 @@ proto_agent_send_rlc_data_req(const protocol_ctxt_t* const ctxt_pP, const srb_fl
|
||||
int msgsize = 0;
|
||||
if (init_msg != NULL)
|
||||
{
|
||||
printf("Will pack the message\n");
|
||||
|
||||
msg = proto_agent_pack_message(init_msg, &msgsize);
|
||||
|
||||
printf("Will free the message\n");
|
||||
free(init_msg);
|
||||
|
||||
|
||||
LOG_I(PROTO_AGENT,"Server sending the pdcp data_req message over the async channel\n");
|
||||
|
||||
if (msg!=NULL)
|
||||
@@ -441,7 +439,7 @@ proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_f
|
||||
printf("Will pack the message \n");
|
||||
msg = proto_agent_pack_message(init_msg, &msgsize);
|
||||
printf("packed the message \n");
|
||||
free(init_msg);
|
||||
//free(init_msg);
|
||||
|
||||
if (msg!=NULL)
|
||||
{
|
||||
@@ -496,7 +494,7 @@ proto_server_receive(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
free(data);
|
||||
//free(data);
|
||||
|
||||
ser_msg = proto_agent_pack_message(msg, &size);
|
||||
}
|
||||
@@ -554,7 +552,7 @@ proto_client_receive(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
free(data);
|
||||
//free(data);
|
||||
|
||||
ser_msg = proto_agent_pack_message(msg, &size);
|
||||
}
|
||||
|
||||
@@ -242,13 +242,13 @@ int proto_agent_destroy_pdcp_data_req(Protocol__FlexsplitMessage *msg) {
|
||||
if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_REQ_MSG)
|
||||
goto error;
|
||||
|
||||
//free(msg->data_req_msg->header);
|
||||
//free(msg->data_req_msg->pdcp_data->fsp_pdu->fsp_pdu_data.data);
|
||||
//free(msg->data_req_msg->pdcp_data->fsp_pdu);
|
||||
//free(msg->data_req_msg->pdcp_data->fsp_ctxt);
|
||||
//free(msg->data_req_msg->pdcp_data);
|
||||
//free(msg->data_req_msg);
|
||||
//free(msg);
|
||||
free(msg->data_req_msg->header);
|
||||
free(msg->data_req_msg->pdcp_data->fsp_pdu->fsp_pdu_data.data);
|
||||
free(msg->data_req_msg->pdcp_data->fsp_pdu);
|
||||
free(msg->data_req_msg->pdcp_data->fsp_ctxt);
|
||||
free(msg->data_req_msg->pdcp_data);
|
||||
free(msg->data_req_msg);
|
||||
free(msg);
|
||||
return 0;
|
||||
|
||||
error:
|
||||
@@ -355,6 +355,8 @@ int proto_agent_pdcp_data_req_ack(mid_t mod_id, const void *params, Protocol__Fl
|
||||
return 0;
|
||||
|
||||
error:
|
||||
if (pdcp_pdu_p != NULL)
|
||||
free_mem_block(pdcp_pdu_p);
|
||||
if(header != NULL)
|
||||
free(header);
|
||||
if(ack!=NULL)
|
||||
@@ -370,9 +372,9 @@ int proto_agent_destroy_pdcp_data_req_ack(Protocol__FlexsplitMessage *msg) {
|
||||
if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_REQ_ACK)
|
||||
goto error;
|
||||
|
||||
//free(msg->data_req_ack->header);
|
||||
//free(msg->data_req_ack);
|
||||
//free(msg);
|
||||
free(msg->data_req_ack->header);
|
||||
free(msg->data_req_ack);
|
||||
free(msg);
|
||||
return 0;
|
||||
|
||||
error:
|
||||
@@ -385,9 +387,9 @@ int proto_agent_destroy_pdcp_data_ind(Protocol__FlexsplitMessage *msg) {
|
||||
if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_IND_MSG)
|
||||
goto error;
|
||||
|
||||
//free(msg->data_req_ack->header);
|
||||
//free(msg->data_req_ack);
|
||||
//free(msg);
|
||||
free(msg->data_req_ack->header);
|
||||
free(msg->data_req_ack);
|
||||
free(msg);
|
||||
return 0;
|
||||
|
||||
error:
|
||||
@@ -591,6 +593,9 @@ int proto_agent_pdcp_data_ind_ack(mid_t mod_id, const void *params, Protocol__Fl
|
||||
free(ack);
|
||||
if(*msg != NULL)
|
||||
free(*msg);
|
||||
if (pdcp_pdu_p != NULL)
|
||||
free_mem_block(pdcp_pdu_p);
|
||||
|
||||
LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
|
||||
return -1;
|
||||
|
||||
@@ -601,9 +606,9 @@ int proto_agent_destroy_pdcp_data_ind_ack(Protocol__FlexsplitMessage *msg) {
|
||||
if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_IND_ACK)
|
||||
goto error;
|
||||
|
||||
//free(msg->data_req_ack->header);
|
||||
//free(msg->data_req_ack);
|
||||
//free(msg);
|
||||
free(msg->data_req_ack->header);
|
||||
free(msg->data_req_ack);
|
||||
free(msg);
|
||||
return 0;
|
||||
|
||||
error:
|
||||
@@ -764,9 +769,9 @@ int proto_agent_destroy_echo_reply(Protocol__FlexsplitMessage *msg) {
|
||||
if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_ECHO_REPLY_MSG)
|
||||
goto error;
|
||||
|
||||
//free(msg->echo_reply_msg->header);
|
||||
//free(msg->echo_reply_msg);
|
||||
//free(msg);
|
||||
free(msg->echo_reply_msg->header);
|
||||
free(msg->echo_reply_msg);
|
||||
free(msg);
|
||||
return 0;
|
||||
|
||||
error:
|
||||
|
||||
Reference in New Issue
Block a user