fix memory leak: vlr: vlr_gsupc_read_cb() must msgb_free()

Add required msgb_free() to vlr_gsupc_read_cb().

Adjust msc_vlr_tests.c gsup_rx() to *not* free the msgb again after
vlr_gsupc_read_cb() did.

Related: OS#2476
Change-Id: I347c53f57a7fa79921aed3f6e42599841acf27c0
changes/77/4077/2
Neels Hofmeyr 5 years ago committed by Neels Hofmeyr
parent 5c76e0aa1a
commit 834f94a2cb
  1. 1
      src/libvlr/vlr.c
  2. 2
      tests/msc_vlr/msc_vlr_tests.c

@ -804,6 +804,7 @@ int vlr_gsupc_read_cb(struct gsup_client *gsupc, struct msgb *msg)
osmo_hexdump_nospc(msgb_l2(msg), msgb_l2len(msg)));
rc = osmo_gsup_decode(msgb_l2(msg), msgb_l2len(msg), &gsup);
msgb_free(msg);
if (rc < 0) {
LOGP(DVLR, LOGL_ERROR,
"decoding GSUP message fails with error '%s' (%d)\n",

@ -130,12 +130,12 @@ void gsup_rx(const char *rx_hex, const char *expect_tx_hex)
label = osmo_gsup_message_type_name(msg->l2h[0]);
fprintf(stderr, "<-- GSUP rx %s: %s\n", label,
osmo_hexdump_nospc(msgb_l2(msg), msgb_l2len(msg)));
/* GSUP read cb takes ownership of msgb */
rc = vlr_gsupc_read_cb(net->vlr->gsup_client, msg);
fprintf(stderr, "<-- GSUP rx %s: vlr_gsupc_read_cb() returns %d\n",
label, rc);
if (expect_tx_hex)
OSMO_ASSERT(gsup_tx_confirmed);
talloc_free(msg);
}
bool conn_exists(struct gsm_subscriber_connection *conn)

Loading…
Cancel
Save