Fix memory leaks in IdList::{MoveSelfInto,DeepCopyInto}.
Note that this requires IdLists to be zero-initialized to work correctly.
This commit is contained in:
parent
45f056c852
commit
97fa6355cc
@ -348,12 +348,14 @@ public:
|
||||
}
|
||||
|
||||
void MoveSelfInto(IdList<T,H> *l) {
|
||||
l->Clear();
|
||||
memcpy(l, this, sizeof(*this));
|
||||
elemsAllocated = n = 0;
|
||||
elem = NULL;
|
||||
}
|
||||
|
||||
void DeepCopyInto(IdList<T,H> *l) {
|
||||
l->Clear();
|
||||
l->elem = (T *)MemAlloc(elemsAllocated * sizeof(elem[0]));
|
||||
memcpy(l->elem, elem, elemsAllocated * sizeof(elem[0]));
|
||||
l->elemsAllocated = elemsAllocated;
|
||||
|
Loading…
Reference in New Issue
Block a user