osmo-gbproxy: Free msgb in ns2 prim callback

Commit cce88282388f in libosmocore changed the msg ownership model - the
callback that the user registers is now responsible for freeing the msg.

Change-Id: Iee940aba7d94afefb5957dbe5f0b04dcf951b31c
Related: SYS#4998
This commit is contained in:
Daniel Willmann 2020-11-04 17:32:56 +01:00 committed by laforge
parent 5818b04a2e
commit b655010d95
2 changed files with 2 additions and 3 deletions

View File

@ -1470,6 +1470,7 @@ int gprs_ns2_prim_cb(struct osmo_prim_hdr *oph, void *ctx)
msgb_nsei(oph->msg) = nsp->nsei; msgb_nsei(oph->msg) = nsp->nsei;
rc = gbprox_rcvmsg(cfg, oph->msg); rc = gbprox_rcvmsg(cfg, oph->msg);
msgb_free(oph->msg);
break; break;
case PRIM_NS_STATUS: case PRIM_NS_STATUS:
gprs_ns_prim_status_cb(cfg, nsp); gprs_ns_prim_status_cb(cfg, nsp);

View File

@ -505,7 +505,6 @@ static void send_ns_unitdata(struct gprs_ns2_inst *nsi, const char *text,
PRIM_OP_INDICATION, msg); PRIM_OP_INDICATION, msg);
gprs_ns2_callback(&nsp.oph, &gbcfg); gprs_ns2_callback(&nsp.oph, &gbcfg);
talloc_free(msg);
} }
static int gbprox_test_bssgp_send_cb(void *ctx, struct msgb *msg); static int gbprox_test_bssgp_send_cb(void *ctx, struct msgb *msg);
@ -1037,9 +1036,8 @@ static int gprs_ns2_callback(struct osmo_prim_hdr *oph, void *ctx)
break; break;
} }
/* Hand off to gbproxy */ /* Hand off to gbproxy which will free the msg */
return gprs_ns2_prim_cb(oph, ctx); return gprs_ns2_prim_cb(oph, ctx);
} }
/* Get the next message from the receive FIFO /* Get the next message from the receive FIFO