summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/netlist/plib/pstring.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/netlist/plib/pstring.cpp')
-rw-r--r--src/lib/netlist/plib/pstring.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/lib/netlist/plib/pstring.cpp b/src/lib/netlist/plib/pstring.cpp
index baeace1edb9..3369f23b6e2 100644
--- a/src/lib/netlist/plib/pstring.cpp
+++ b/src/lib/netlist/plib/pstring.cpp
@@ -415,16 +415,19 @@ static inline std::size_t countleadbits(std::size_t x)
template<typename F>
void pstring_t<F>::sfree(pstr_t *s)
{
- bool b = s->dec_and_check();
- if ( b && s != &m_zero)
+ if (s != nullptr)
{
- if (stk != nullptr)
+ bool b = s->dec_and_check();
+ if ( b && s != &m_zero)
{
- size_type sn= ((32 - countleadbits(s->len())) + 1) / 2;
- stk[sn].push(s);
+ if (stk != nullptr)
+ {
+ size_type sn= ((32 - countleadbits(s->len())) + 1) / 2;
+ stk[sn].push(s);
+ }
+ else
+ plib::pfree_array(reinterpret_cast<char *>(s));
}
- else
- plib::pfree_array(reinterpret_cast<char *>(s));
}
}