Fix valgrind found error of reading uninitialized data

This commit is contained in:
Jingyu Zhou 2020-02-02 13:15:23 -08:00
parent ee6490c9d1
commit d73a19fea4
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 // 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 ) { 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 ) { 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; }); return map(m_f->readZeroCopy(data, length, offset), [=](Void r) { updateChecksumHistory(false, offset, *length, (uint8_t *)data); return r; });