Skip to content

Commit 70b86ab

Browse files
[CAS] Fix msan error in ObjectStore::importObject() (#167051)
Fix msan error that reference to ObjectRef is used after the storage is deleted. Make sure all usages is finished before deleting the container.
1 parent 4ecb3c7 commit 70b86ab

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

llvm/lib/CAS/ObjectStore.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,13 @@ Expected<ObjectRef> ObjectStore::importObject(ObjectStore &Upstream,
213213

214214
// Remove the current node and its IDs from the stack.
215215
PrimaryRefStack.truncate(PrimaryRefStack.size() - Cur.RefsCount);
216-
CursorStack.pop_back();
217216

217+
// Push new node into created objects.
218218
PrimaryRefStack.push_back(*NewNode);
219219
CreatedObjects.try_emplace(Cur.Ref, *NewNode);
220+
221+
// Pop the cursor in the end after all uses.
222+
CursorStack.pop_back();
220223
continue;
221224
}
222225

0 commit comments

Comments
 (0)