laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-remsim/+/42705?usp=email )
Change subject: rspro_util: asn1 decode: fix memleak when decoding fails ......................................................................
rspro_util: asn1 decode: fix memleak when decoding fails
Change-Id: I071343d0134dbffb1bb71ea26a5b514be1b5bb27 --- M src/rspro_util.c 1 file changed, 2 insertions(+), 0 deletions(-)
Approvals: Jenkins Builder: Verified jolly: Looks good to me, but someone else must approve laforge: Looks good to me, approved
diff --git a/src/rspro_util.c b/src/rspro_util.c index 23bb839..b4b473e 100644 --- a/src/rspro_util.c +++ b/src/rspro_util.c @@ -86,6 +86,8 @@ LOGP(DRSPRO, LOGL_DEBUG, "decoding %s\n", msgb_hexdump(msg)); rval = ber_decode(NULL, &asn_DEF_RsproPDU, (void **) &pdu, msgb_l2(msg), msgb_l2len(msg)); if (rval.code != RC_OK) { + if (pdu) + ASN_STRUCT_FREE(asn_DEF_RsproPDU, pdu); LOGP(DRSPRO, LOGL_ERROR, "Failed to decode: %d. Consumed %zu of %u bytes\n", rval.code, rval.consumed, msgb_length(msg)); return NULL;