laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-iuh/+/37414?usp=email )
Change subject: ranap_cn_rx_co(): do not ranap_cn_rx_co_free() on error ......................................................................
ranap_cn_rx_co(): do not ranap_cn_rx_co_free() on error
When ranap_cn_rx_co_decode2() returns an error, we should not call ranap_cn_rx_co_free(). It results in logging
DRANAP INFO Freeing RANAP Procedure unknown 0x0 (CO) from RNC not implemented
Change the function flow to early-exit pattern to skip ranap_cn_rx_co_free() on error.
Change-Id: If7545f91c69f06bc32c55cab7dcfcad8350b0473 --- M src/ranap_common_cn.c 1 file changed, 23 insertions(+), 6 deletions(-)
Approvals: daniel: Looks good to me, but someone else must approve laforge: Looks good to me, approved Jenkins Builder: Verified
diff --git a/src/ranap_common_cn.c b/src/ranap_common_cn.c index 81dcdca..8d0cc0c 100644 --- a/src/ranap_common_cn.c +++ b/src/ranap_common_cn.c @@ -414,16 +414,16 @@ int rc;
rc = ranap_cn_rx_co_decode2(&message, data, len); - - if (rc == 0) - (*cb)(priv, &message); - else + if (rc) { LOGP(DRANAP, LOGL_ERROR, "Not calling cn_ranap_handle_co() due to rc=%d\n", rc); + return rc; + } + + (*cb)(priv, &message);
/* Free the asn1 structs in message */ ranap_cn_rx_co_free(&message); - - return rc; + return 0; }
static int cn_ranap_rx_initiating_msg_cl(RANAP_InitiatingMessage_t *imsg, ranap_message *message)