Fix two Xcode warnings: malloc sizeof NSUInteger for NSInteger array, and assigning to *error pointers without a NULL check