Merge pull request #2636 from jzhou77/valgrind-fix

Fix valgrind found error of reading uninitialized data
This commit is contained in:
Jingyu Zhou 2020-02-03 13:12:49 -08:00 committed by GitHub
commit 2b81b128f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -32,7 +32,10 @@ public:
// For read() and write(), the data buffer must remain valid until the future is ready
Future<int> read( void* data, int length, int64_t offset ) {
return map(m_f->read(data, length, offset), [=](int r) { updateChecksumHistory(false, offset, length, (uint8_t *)data); return r; });
return map(m_f->read(data, length, offset), [=](int r) {
updateChecksumHistory(false, offset, r, (uint8_t*)data);
return r;
});
}
Future<Void> readZeroCopy( void** data, int* length, int64_t offset ) {
return map(m_f->readZeroCopy(data, length, offset), [=](Void r) { updateChecksumHistory(false, offset, *length, (uint8_t *)data); return r; });