block/partitions: optimize memory allocation in check_partition()