laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-iuh/+/38333?usp=email )
Change subject: fix memleak in ran_decode: free after aper_decode() on error ......................................................................
fix memleak in ran_decode: free after aper_decode() on error
Same fix as recently [1] applied to ranap_cn_rx_co_decode() now also applied to ranap_ran_rx_co_decode()
[1] 48e1f1833ff06088c875157cc912dc25c5a01c29 I03ed2376e520ec6dbcc2bae22f9291e211c7cca9
Change-Id: Idd1d10c523eddcf6d0c1d54346982d6ef6fc3799 --- M src/ranap_common_ran.c 1 file changed, 3 insertions(+), 1 deletion(-)
Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved
diff --git a/src/ranap_common_ran.c b/src/ranap_common_ran.c index 048a5df..828587e 100644 --- a/src/ranap_common_ran.c +++ b/src/ranap_common_ran.c @@ -300,13 +300,15 @@ dec_ret = aper_decode(NULL, &asn_DEF_RANAP_RANAP_PDU, (void **)&pdu, data, len, 0, 0); if (dec_ret.code != RC_OK) { LOGP(DRANAP, LOGL_ERROR, "Error in RANAP ASN.1 decode\n"); - return -1; + rc = -1; + goto error_free; }
message->direction = pdu->present;
rc = _ran_ranap_rx_co(ctx, pdu, message);
+error_free: ASN_STRUCT_FREE(asn_DEF_RANAP_RANAP_PDU, pdu);
return rc;