Fix copy.

This commit is contained in:
XMRig 2019-03-16 13:32:00 +07:00
parent 1b9fbf1132
commit c94c0210f7

View file

@ -178,17 +178,13 @@ void xmrig::String::copy(const char *str)
void xmrig::String::copy(const String &other) void xmrig::String::copy(const String &other)
{ {
if (m_size > 0) { if (m_size > 0 && m_size == other.m_size) {
if (m_size == other.m_size) {
memcpy(m_data, other.m_data, m_size + 1); memcpy(m_data, other.m_data, m_size + 1);
return; return;
} }
delete [] m_data; delete [] m_data;
}
delete [] m_data;
if (other.m_data == nullptr) { if (other.m_data == nullptr) {
m_size = 0; m_size = 0;