Change memory allocation from heap to stack
[sim/e2-interface.git] / e2sim / src / encoding / encode_e2apv1.cpp
old mode 100644 (file)
new mode 100755 (executable)
index 6f8c589..1416e5e
@@ -60,7 +60,6 @@ long encoding::get_function_id_from_subscription(E2AP_PDU_t *e2ap_pdu) {
 
   RICsubscriptionRequest_t orig_req =
     e2ap_pdu->choice.initiatingMessage->value.choice.RICsubscriptionRequest;
-  
   RICsubscriptionResponse_IEs_t *ricreqid =
     (RICsubscriptionResponse_IEs_t*)calloc(1, sizeof(RICsubscriptionResponse_IEs_t));
                                           
@@ -410,7 +409,7 @@ void encoding::generate_e2apv1_subscription_request(E2AP_PDU *e2ap_pdu) {
   e2ap_pdu->present = pres5;
   e2ap_pdu->choice.initiatingMessage = initmsg;
 
-  char *error_buf = (char*)calloc(300, sizeof(char));;
+  char error_buf[300] = {0, };
   size_t errlen;
                                                                          
   asn_check_constraints(&asn_DEF_E2AP_PDU, e2ap_pdu, error_buf, &errlen);
@@ -521,7 +520,7 @@ void encoding::generate_e2apv1_subscription_response_success(E2AP_PDU *e2ap_pdu,
   e2ap_pdu->present = pres5;
   e2ap_pdu->choice.successfulOutcome = successoutcome;
 
-  char *error_buf = (char*)calloc(300, sizeof(char));
+  char error_buf[300] = {0, };
   size_t errlen;
 
   asn_check_constraints(&asn_DEF_E2AP_PDU, e2ap_pdu, error_buf, &errlen);
@@ -676,7 +675,7 @@ void encoding::generate_e2apv1_subscription_response(E2AP_PDU *e2ap_pdu, E2AP_PD
   e2ap_pdu->present = pres5;
   e2ap_pdu->choice.successfulOutcome = successoutcome;
 
-  char *error_buf = (char*)calloc(300, sizeof(char));
+  char error_buf[300] = {0, };
   size_t errlen;
 
   asn_check_constraints(&asn_DEF_E2AP_PDU, e2ap_pdu, error_buf, &errlen);
@@ -851,8 +850,7 @@ void encoding::generate_e2apv1_indication_request_parameterized(E2AP_PDU *e2ap_p
   
   e2ap_pdu->present = pres5;
   e2ap_pdu->choice.initiatingMessage = initmsg;
-
-  char *error_buf = (char*)calloc(300, sizeof(char));
+  char error_buf[300] = {0, };
   size_t errlen;
 
   asn_check_constraints(&asn_DEF_E2AP_PDU, e2ap_pdu, error_buf, &errlen);