forked from OSchip/llvm-project
In ContentCache::replaceBuffer, add sanity check to make sure that we do not free a buffer
and then continue using it. rdar://10359140. llvm-svn: 146308
This commit is contained in:
parent
8ca0c6408e
commit
cc6107df08
|
@ -71,7 +71,11 @@ unsigned ContentCache::getSize() const {
|
|||
|
||||
void ContentCache::replaceBuffer(const llvm::MemoryBuffer *B,
|
||||
bool DoNotFree) {
|
||||
assert(B != Buffer.getPointer());
|
||||
if (B == Buffer.getPointer()) {
|
||||
assert(0 && "Replacing with the same buffer");
|
||||
Buffer.setInt(DoNotFree? DoNotFreeFlag : 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (shouldFreeBuffer())
|
||||
delete Buffer.getPointer();
|
||||
|
|
Loading…
Reference in New Issue