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
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.