mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
wipeable_string: move a wipe from reserve to grow
That way, all implicit wipes ends up in grow, which is more robust
This commit is contained in:
parent
5f801b6adf
commit
6c94516fb4
1 changed files with 2 additions and 3 deletions
|
@ -89,6 +89,8 @@ void wipeable_string::grow(size_t sz, size_t reserved)
|
||||||
reserved = sz;
|
reserved = sz;
|
||||||
if (reserved <= buffer.capacity())
|
if (reserved <= buffer.capacity())
|
||||||
{
|
{
|
||||||
|
if (sz < buffer.size())
|
||||||
|
wipefunc(buffer.data() + sz, buffer.size() - sz);
|
||||||
buffer.resize(sz);
|
buffer.resize(sz);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -115,9 +117,6 @@ void wipeable_string::pop_back()
|
||||||
|
|
||||||
void wipeable_string::resize(size_t sz)
|
void wipeable_string::resize(size_t sz)
|
||||||
{
|
{
|
||||||
CHECK_AND_ASSERT_THROW_MES(wipefunc, "wipefunc is not set");
|
|
||||||
if (sz < buffer.size())
|
|
||||||
wipefunc(buffer.data() + sz, buffer.size() - sz);
|
|
||||||
grow(sz);
|
grow(sz);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue