From 11e912aa6e57ee956d45fc7545141544cdc99b91 Mon Sep 17 00:00:00 2001 From: Daniel Willmann Date: Thu, 7 Jan 2016 13:19:30 +0100 Subject: Free ies struct after use in tests and hnbgw_cn/rua --- src/hnbgw_cn.c | 5 +++++ src/hnbgw_rua.c | 6 ++++++ src/tests/hnb-test.c | 2 ++ src/tests/test-hnbap.c | 4 ++++ 4 files changed, 17 insertions(+) diff --git a/src/hnbgw_cn.c b/src/hnbgw_cn.c index 18661ea..d8824ea 100644 --- a/src/hnbgw_cn.c +++ b/src/hnbgw_cn.c @@ -102,6 +102,8 @@ static int cn_ranap_rx_reset_cmd(struct hnbgw_cnlink *cnlink, rc = ranap_decode_reseties(&ies, &imsg->value); /* FIXME: reset resources and return reset ack */ + + ranap_free_reseties(&ies); return rc; } @@ -115,6 +117,7 @@ static int cn_ranap_rx_reset_ack(struct hnbgw_cnlink *cnlink, hnbgw_cnlink_change_state(cnlink, CNLINK_S_EST_ACTIVE); + ranap_free_resetacknowledgeies(&ies); return rc; } @@ -134,6 +137,8 @@ static int cn_ranap_rx_paging_cmd(struct hnbgw_cnlink *cnlink, llist_for_each_entry(hnb, &gw->hnb_list, list) { rc = rua_tx_udt(hnb, data, len); } + + ranap_free_pagingies(&ies); return 0; } diff --git a/src/hnbgw_rua.c b/src/hnbgw_rua.c index 4059cf8..a6f0100 100644 --- a/src/hnbgw_rua.c +++ b/src/hnbgw_rua.c @@ -301,6 +301,7 @@ static int rua_rx_init_connect(struct msgb *msg, ANY_t *in) default: LOGP(DRUA, LOGL_ERROR, "Unsupported Domain %u\n", ies.cN_DomainIndicator); + rua_free_connecties(&ies); return -1; } @@ -312,6 +313,7 @@ static int rua_rx_init_connect(struct msgb *msg, ANY_t *in) context_id, 0, ies.ranaP_Message.buf, ies.ranaP_Message.size); /* FIXME: what to do with the asn1c-allocated memory */ + rua_free_connecties(&ies); return rc; } @@ -355,6 +357,7 @@ static int rua_rx_init_disconnect(struct msgb *msg, ANY_t *in) rc = rua_to_scu(hnb, cn, OSMO_SCU_PRIM_N_DISCONNECT, context_id, scu_cause, ranap_data, ranap_len); /* FIXME: what to do with the asn1c-allocated memory */ + rua_free_disconnecties(&ies); return rc; } @@ -389,6 +392,7 @@ static int rua_rx_init_dt(struct msgb *msg, ANY_t *in) context_id, 0, ies.ranaP_Message.buf, ies.ranaP_Message.size); /* FIXME: what to do with the asn1c-allocated memory */ + rua_free_directtransferies(&ies); return rc; @@ -414,6 +418,7 @@ static int rua_rx_init_udt(struct msgb *msg, ANY_t *in) * can ignore. In either case, it is RANAP that we need to * decode... */ rc = hnbgw_ranap_rx(msg, ies.ranaP_Message.buf, ies.ranaP_Message.size); + rua_free_connectionlesstransferies(&ies); return rc; } @@ -431,6 +436,7 @@ static int rua_rx_init_err_ind(struct msgb *msg, ANY_t *in) LOGP(DRUA, LOGL_ERROR, "RUA UData.ErrorInd(%s)\n", rua_cause_str(&ies.cause)); + rua_free_errorindicationies(&ies); return rc; } diff --git a/src/tests/hnb-test.c b/src/tests/hnb-test.c index e2fa2ed..35700c2 100644 --- a/src/tests/hnb-test.c +++ b/src/tests/hnb-test.c @@ -140,6 +140,7 @@ static int hnb_test_rx_hnb_register_acc(struct hnb_test *hnb, ANY_t *in) hnb->rnc_id = accept.rnc_id; printf("HNB Register accept with RNC ID %u\n", hnb->rnc_id); + hnbap_free_hnbregisteraccepties(&accept); return 0; } @@ -167,6 +168,7 @@ static int hnb_test_rx_ue_register_acc(struct hnb_test *hnb, ANY_t *in) printf("UE Register accept for IMSI %s, context %u\n", imsi, ctx_id); hnb->ctx_id = ctx_id; + hnbap_free_ueregisteraccepties(&accept); return 0; } diff --git a/src/tests/test-hnbap.c b/src/tests/test-hnbap.c index 463b4d4..c6e7d94 100644 --- a/src/tests/test-hnbap.c +++ b/src/tests/test-hnbap.c @@ -120,6 +120,8 @@ void test_asn1_decoding(void) ASSERT(!strcmp((char *) hnb_ies.hnB_Identity.hNB_Identity_Info.buf, "10005B9-0010942050@")); printf("HNBAP register request for HNB %s\n", (char *) hnb_ies.hnB_Identity.hNB_Identity_Info.buf); + hnbap_free_hnbregisterrequesties(&hnb_ies); + dec_ret = aper_decode(NULL, &asn_DEF_HNBAP_PDU, (void **) &pdu, hnbap_ue_reg_req, sizeof(hnbap_ue_reg_req), 0, 0); @@ -138,6 +140,7 @@ void test_asn1_decoding(void) ue_req_ies.uE_Identity.choice.iMSI.size); printf("HNBAP UE Register request from IMSI %s\n", imsi); + hnbap_free_ueregisterrequesties(&ue_req_ies); memset(pdu, 0, sizeof(*pdu)); dec_ret = aper_decode(NULL, &asn_DEF_HNBAP_PDU, (void **) &pdu, @@ -158,6 +161,7 @@ void test_asn1_decoding(void) ue_acc_ies.uE_Identity.choice.iMSI.size); printf("HNBAP UE Register accept to IMSI %s\n", imsi); + hnbap_free_ueregisteraccepties(&ue_acc_ies); } -- cgit v1.2.3