Fix NSPointerArray so that it cleans up its array on dealloc. This is needed

to avoid memory leaks with strong references and heap corruption with weak
ones.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35878 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
David Chisnall 2012-12-11 18:29:49 +00:00
parent 69d4344a0a
commit 1c2ce264aa

View file

@ -335,6 +335,13 @@ static Class concreteClass = Nil;
- (void) dealloc
{
[self finalize];
// For weak memory, we must zero all of the elements, or the runtime will
// keep pointers to them lying around. For strong memory, we must release
// things or they will leak.
for (int i=0 ; i<_count ; i++)
{
pointerFunctionsAssign(&_pf, &_contents[i], 0);
}
if (_contents != 0)
{
NSZoneFree([self zone], _contents);