mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-28 04:33:05 +00:00
Fixing a possible memory leak from a failing realloc() call.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195018 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6919bec07f
commit
eae6e546ec
@ -202,8 +202,13 @@ void SmallPtrSetImpl::CopyFrom(const SmallPtrSetImpl &RHS) {
|
|||||||
} else if (CurArraySize != RHS.CurArraySize) {
|
} else if (CurArraySize != RHS.CurArraySize) {
|
||||||
if (isSmall())
|
if (isSmall())
|
||||||
CurArray = (const void**)malloc(sizeof(void*) * RHS.CurArraySize);
|
CurArray = (const void**)malloc(sizeof(void*) * RHS.CurArraySize);
|
||||||
else
|
else {
|
||||||
CurArray = (const void**)realloc(CurArray, sizeof(void*)*RHS.CurArraySize);
|
const void **T = (const void**)realloc(CurArray,
|
||||||
|
sizeof(void*) * RHS.CurArraySize);
|
||||||
|
if (!T)
|
||||||
|
free(CurArray);
|
||||||
|
CurArray = T;
|
||||||
|
}
|
||||||
assert(CurArray && "Failed to allocate memory?");
|
assert(CurArray && "Failed to allocate memory?");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user