From a2848546d2fc7db99451fa30fe31af90f82b8992 Mon Sep 17 00:00:00 2001 From: Alexander Couzens Date: Mon, 26 Oct 2020 00:33:31 +0100 Subject: [PATCH] NS2: follow the change of ownership When receiving a primitive from the NS2 layer the PCU must free the msg buffer if given. Change-Id: I180433735bfbb3375c41318d7a7709d5845199ba --- src/gprs_bssgp_pcu.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp index 413408d1..671629bd 100644 --- a/src/gprs_bssgp_pcu.cpp +++ b/src/gprs_bssgp_pcu.cpp @@ -597,7 +597,7 @@ int gprs_ns_prim_cb(struct osmo_prim_hdr *oph, void *ctx) LOGP(DPCU, LOGL_NOTICE, "NS: %s Unknown prim %d from NS\n", get_value_string(osmo_prim_op_names, oph->operation), oph->operation); - return 0; + goto out; } switch (oph->primitive) { @@ -620,6 +620,10 @@ int gprs_ns_prim_cb(struct osmo_prim_hdr *oph, void *ctx) break; } +out: + if (oph->msg) + msgb_free(oph->msg); + return rc; }