mirror of
https://github.com/holub/mame
synced 2025-04-25 17:56:43 +03:00
Fix a bug in pstring.cpp causing crash if moved object is reused. (nw)
This commit is contained in:
parent
ee8fed61c2
commit
f61e1f2123
@ -415,16 +415,19 @@ static inline std::size_t countleadbits(std::size_t x)
|
|||||||
template<typename F>
|
template<typename F>
|
||||||
void pstring_t<F>::sfree(pstr_t *s)
|
void pstring_t<F>::sfree(pstr_t *s)
|
||||||
{
|
{
|
||||||
bool b = s->dec_and_check();
|
if (s != nullptr)
|
||||||
if ( b && s != &m_zero)
|
|
||||||
{
|
{
|
||||||
if (stk != nullptr)
|
bool b = s->dec_and_check();
|
||||||
|
if ( b && s != &m_zero)
|
||||||
{
|
{
|
||||||
size_type sn= ((32 - countleadbits(s->len())) + 1) / 2;
|
if (stk != nullptr)
|
||||||
stk[sn].push(s);
|
{
|
||||||
|
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));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user