Bug fix for allocating array of unknown size

@jklontz please review