readvalidation with malloc