aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Willmann <dwillmann@sysmocom.de>2020-11-04 17:32:56 +0100
committerlaforge <laforge@osmocom.org>2020-11-09 10:54:09 +0000
commit02f2c34f8a1fa726e3c3fa3f6e564eb18faaca88 (patch)
treee3b402512424efb966e1f04df2cec33a18190c61
parent62fa6198aee1cab0b78d820e1f6440c28930a71e (diff)
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
-rw-r--r--src/gbproxy/gb_proxy.c1
-rw-r--r--tests/gbproxy/gbproxy_test.c4
2 files changed, 2 insertions, 3 deletions
diff --git a/src/gbproxy/gb_proxy.c b/src/gbproxy/gb_proxy.c
index ccf3f734..fb58284d 100644
--- a/src/gbproxy/gb_proxy.c
+++ b/src/gbproxy/gb_proxy.c
@@ -1470,6 +1470,7 @@ int gprs_ns2_prim_cb(struct osmo_prim_hdr *oph, void *ctx)
msgb_nsei(oph->msg) = nsp->nsei;
rc = gbprox_rcvmsg(cfg, oph->msg);
+ msgb_free(oph->msg);
break;
case PRIM_NS_STATUS:
gprs_ns_prim_status_cb(cfg, nsp);
diff --git a/tests/gbproxy/gbproxy_test.c b/tests/gbproxy/gbproxy_test.c
index 16629800..76fc000d 100644
--- a/tests/gbproxy/gbproxy_test.c
+++ b/tests/gbproxy/gbproxy_test.c
@@ -505,7 +505,6 @@ static void send_ns_unitdata(struct gprs_ns2_inst *nsi, const char *text,
PRIM_OP_INDICATION, msg);
gprs_ns2_callback(&nsp.oph, &gbcfg);
- talloc_free(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;
}
- /* Hand off to gbproxy */
+ /* Hand off to gbproxy which will free the msg */
return gprs_ns2_prim_cb(oph, ctx);
-
}
/* Get the next message from the receive FIFO