This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Neels Hofmeyr gerrit-no-reply at lists.osmocom.orgNeels Hofmeyr has submitted this change and it was merged.
Change subject: memleak: fix all libosmocore callers of gsmtap_sendmsg() to free on failure
......................................................................
memleak: fix all libosmocore callers of gsmtap_sendmsg() to free on failure
gsmtap_sendmsg() does not free the msgb if it returns a failure rc, so the
callers must check the rc and free the msg.
Change-Id: I7cf64ed9b14247298ed8b4ab8735627f8235a499
---
M src/gsmtap_util.c
M src/logging_gsmtap.c
2 files changed, 8 insertions(+), 2 deletions(-)
Approvals:
Vadim Yanitskiy: Looks good to me, but someone else must approve
Harald Welte: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/src/gsmtap_util.c b/src/gsmtap_util.c
index 962782b..b21c690 100644
--- a/src/gsmtap_util.c
+++ b/src/gsmtap_util.c
@@ -303,6 +303,7 @@
unsigned int len)
{
struct msgb *msg;
+ int rc;
if (!gti)
return -ENODEV;
@@ -312,7 +313,10 @@
if (!msg)
return -ENOMEM;
- return gsmtap_sendmsg(gti, msg);
+ rc = gsmtap_sendmsg(gti, msg);
+ if (rc)
+ msgb_free(msg);
+ return rc;
}
/*! send a message from L1/L2 through GSMTAP.
diff --git a/src/logging_gsmtap.c b/src/logging_gsmtap.c
index cb379b0..c53a0ab 100644
--- a/src/logging_gsmtap.c
+++ b/src/logging_gsmtap.c
@@ -103,7 +103,9 @@
return;
msgb_put(msg, rc);
- gsmtap_sendmsg(target->tgt_gsmtap.gsmtap_inst, msg);
+ rc = gsmtap_sendmsg(target->tgt_gsmtap.gsmtap_inst, msg);
+ if (rc)
+ msgb_free(msg);
}
/*! Create a new logging target for GSMTAP logging
--
To view, visit https://gerrit.osmocom.org/6514
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7cf64ed9b14247298ed8b4ab8735627f8235a499
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>