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
This commit is contained in:
Jacob Erlbeck 2015-06-11 12:45:47 +02:00
parent 0ae4313800
commit 7bf9f49728
1 changed files with 3 additions and 0 deletions

View File

@ -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(),