@@ -1576,19 +1576,21 @@ return value; } - (of_unichar_t*)unicodeString { + OFObject *object = [[[OFObject alloc] init] autorelease]; of_unichar_t *ret; - size_t i, j, len; - - len = [self length]; - - if ((ret = malloc((len + 1) * sizeof(of_unichar_t))) == NULL) - @throw [OFOutOfMemoryException newWithClass: isa]; - - i = j = 0; + size_t i, j; + + ret = [object allocMemoryForNItems: [self length] + 2 + withSize: sizeof(of_unichar_t)]; + + i = 0; + j = 0; + + ret[j++] = 0xFEFF; while (i < length) { of_unichar_t c; size_t cLen;