fix: Invalid memory access (#2435)

The (subtle) bug is that the previous code uses an `initializer_list` c'tor, which copies the
`string_view` locally. Then it keeps that reference to the `string_view`,
but it goes out of scope in the next line
This commit is contained in:
Shahar Mike 2024-01-17 23:23:44 +02:00 committed by GitHub
parent d1db48d9d4
commit b66db852f9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -195,7 +195,7 @@ unsigned PrimeEvictionPolicy::Evict(const PrimeTable::HotspotBuckets& eb, PrimeT
// log the evicted keys to journal.
if (auto journal = db_slice_->shard_owner()->journal(); journal) {
ArgSlice delete_args{key};
ArgSlice delete_args(&key, 1);
journal->RecordEntry(0, journal::Op::EXPIRED, cntx_.db_index, 1, ClusterConfig::KeySlot(key),
make_pair("DEL", delete_args), false);
}