diff options
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-06-11 12:45:47 +0200
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-06-11 13:13:55 +0200
commit7bf9f49728a306976b1974a52a9039807b0a2979 (patch)
parent0ae431380015a5c6a944a9edd1620e56b0b65445 (diff)
tbf: Check for NULL in name() (Coverity)
The gprs_rlcmac_tbf::name() method is generally used to generate log messages. To avoid the need for an explicit NULL check for the tbf and to get a consistent text if it is NULL, this commit adds a NULL check to the method itself so that it can be called with this == NULL. Fixes: Coverity CID 1304680, 1304681 Sponsored-by: On-Waves ehf
1 files changed, 3 insertions, 0 deletions
diff --git a/src/tbf.cpp b/src/tbf.cpp
index f3c5e69e..ac099cf0 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -914,6 +914,9 @@ const char *tbf_name(gprs_rlcmac_tbf *tbf)
const char *gprs_rlcmac_tbf::name() const
+ if (this == NULL)
+ return "(no TBF)";
snprintf(m_name_buf, sizeof(m_name_buf) - 1,
"TBF(TFI=%d TLLI=0x%08x DIR=%s STATE=%s)",
m_tfi, tlli(),