Skip to content

Commit

Permalink
Fixing memory leak when handling FDBResult in multi version client
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-jslocum committed May 2, 2022
1 parent 57e1b48 commit 8284ec5
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions fdbclient/MultiVersionTransaction.actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,17 +300,7 @@ ThreadResult<RangeResult> DLTransaction::readBlobGranules(const KeyRangeRef& key
beginVersion,
rv,
context);
const FdbCApi::FDBKeyValue* kvs;
int count;
FdbCApi::fdb_bool_t more;
FdbCApi::fdb_error_t error = api->resultGetKeyValueArray(r, &kvs, &count, &more);
if (error) {
return ThreadResult<RangeResult>(Error(error));
}

// The memory for this is stored in the FDBResult and is released when the result gets destroyed
return ThreadResult<RangeResult>(
RangeResult(RangeResultRef(VectorRef<KeyValueRef>((KeyValueRef*)kvs, count), more), Arena()));
return ThreadResult<RangeResult>((ThreadSingleAssignmentVar<RangeResult>*)(r));
}

void DLTransaction::addReadConflictRange(const KeyRangeRef& keys) {
Expand Down

0 comments on commit 8284ec5

Please sign in to comment.