summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerwin coumans <erwin.coumans@gmail.com>2022-04-25 18:31:07 -0700
committererwin coumans <erwin.coumans@gmail.com>2022-04-25 18:31:07 -0700
commit9185f93174d5e24f06dbec6bb4c2868fd72617ed (patch)
treed1d0dff8bd386c0bd539cde5c224c4e4b2c8119c
parent9eb945b1e846cf2a3d074ec4c2625dd0b4fc9875 (diff)
downloadbullet3-9185f93174d5e24f06dbec6bb4c2868fd72617ed.tar.gz
manually copy data, to avoid possible memory leaks.
-rw-r--r--src/Bullet3Common/b3AlignedObjectArray.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/Bullet3Common/b3AlignedObjectArray.h b/src/Bullet3Common/b3AlignedObjectArray.h
index 7d31b56d0..8ef3331f7 100644
--- a/src/Bullet3Common/b3AlignedObjectArray.h
+++ b/src/Bullet3Common/b3AlignedObjectArray.h
@@ -135,7 +135,11 @@ public:
int otherSize = otherArray.size();
resize(otherSize);
- otherArray.copy(0, otherSize, m_data);
+ //don't use otherArray.copy, it can leak memory
+ for (int i = 0; i < otherSize; i++)
+ {
+ m_data[i] = otherArray[i];
+ }
}
/// return the number of elements in the array
@@ -506,7 +510,11 @@ public:
{
int otherSize = otherArray.size();
resize(otherSize);
- otherArray.copy(0, otherSize, m_data);
+ //don't use otherArray.copy, it can leak memory
+ for (int i = 0; i < otherSize; i++)
+ {
+ m_data[i] = otherArray[i];
+ }
}
void removeAtIndex(int index)