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
This commit is contained in:
parent
5c76e0aa1a
commit
834f94a2cb
|
@ -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)));
|
osmo_hexdump_nospc(msgb_l2(msg), msgb_l2len(msg)));
|
||||||
|
|
||||||
rc = osmo_gsup_decode(msgb_l2(msg), msgb_l2len(msg), &gsup);
|
rc = osmo_gsup_decode(msgb_l2(msg), msgb_l2len(msg), &gsup);
|
||||||
|
msgb_free(msg);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
LOGP(DVLR, LOGL_ERROR,
|
LOGP(DVLR, LOGL_ERROR,
|
||||||
"decoding GSUP message fails with error '%s' (%d)\n",
|
"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]);
|
label = osmo_gsup_message_type_name(msg->l2h[0]);
|
||||||
fprintf(stderr, "<-- GSUP rx %s: %s\n", label,
|
fprintf(stderr, "<-- GSUP rx %s: %s\n", label,
|
||||||
osmo_hexdump_nospc(msgb_l2(msg), msgb_l2len(msg)));
|
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);
|
rc = vlr_gsupc_read_cb(net->vlr->gsup_client, msg);
|
||||||
fprintf(stderr, "<-- GSUP rx %s: vlr_gsupc_read_cb() returns %d\n",
|
fprintf(stderr, "<-- GSUP rx %s: vlr_gsupc_read_cb() returns %d\n",
|
||||||
label, rc);
|
label, rc);
|
||||||
if (expect_tx_hex)
|
if (expect_tx_hex)
|
||||||
OSMO_ASSERT(gsup_tx_confirmed);
|
OSMO_ASSERT(gsup_tx_confirmed);
|
||||||
talloc_free(msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool conn_exists(struct gsm_subscriber_connection *conn)
|
bool conn_exists(struct gsm_subscriber_connection *conn)
|
||||||
|
|
Loading…
Reference in New Issue