@@ -131,14 +131,14 @@ @try { if (itemSize == 0) @throw [OFInvalidArgumentException exception]; - _items = [self allocMemoryWithSize: itemSize - count: count]; + _items = of_malloc(count, itemSize); _itemSize = itemSize; _count = count; + _freeWhenDone = true; memcpy(_items, items, count * itemSize); } @catch (id e) { [self release]; @throw e; @@ -244,10 +244,11 @@ stream = [URLHandler openItemAtURL: URL mode: @"r"]; _itemSize = 1; _count = 0; + _freeWhenDone = true; pageSize = [OFSystemInfo pageSize]; buffer = of_malloc(1, pageSize); @try { @@ -258,12 +259,11 @@ if (SIZE_MAX - _count < length) @throw [OFOutOfRangeException exception]; - _items = [self resizeMemory: _items - size: _count + length]; + _items = of_realloc(_items, _count + length, 1); memcpy(_items + _count, buffer, length); _count += length; } } @finally { free(buffer); @@ -290,13 +290,14 @@ if (count % 2 != 0) @throw [OFInvalidFormatException exception]; count /= 2; - _items = [self allocMemoryWithSize: count]; + _items = of_malloc(count, 1); _itemSize = 1; _count = count; + _freeWhenDone = true; cString = [string cStringWithEncoding: OF_STRING_ENCODING_ASCII]; for (size_t i = 0; i < count; i++) {