Don't pass null to memcpy
This commit is contained in:
@@ -109,9 +109,13 @@ struct Entry {
|
||||
e->refCount = 1;
|
||||
e->priority = XXH3_64bits(key, keyLen);
|
||||
e->clearTo = clearTo;
|
||||
memcpy((uint8_t *)e->getKey(), key, keyLen);
|
||||
if (keyLen > 0) {
|
||||
memcpy((uint8_t *)e->getKey(), key, keyLen);
|
||||
}
|
||||
((uint8_t *)e->getKey())[keyLen] = 0;
|
||||
memcpy((uint8_t *)e->getVal(), val, std::max(valLen, 0));
|
||||
if (valLen > 0) {
|
||||
memcpy((uint8_t *)e->getVal(), val, valLen);
|
||||
}
|
||||
return e;
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user