Abu As-Safar narrated that Ibn Abbas (may Allah be pleased with them) said: "O people! Let me hear what you say, and understand what I say to you: If a slave is made to perform Hajj by his masters and he dies before being freed, then his Hajj is complete. But if he is freed before dying, then he should perform Hajj (again). And if a child is made to perform Hajj by his family and he dies before Hajj becomes obligatory upon him, then his Hajj is complete. But if he reaches maturity, then he should perform Hajj (again)."
Hadith Referenceمسند الإمام الشافعي / كتاب الحج / 940
Abu As-Safar narrated that Ibn Abbas (may Allah be pleased with them) said: "O people! Let me hear what you say, and understand what I say to you! If a slave is made to perform Hajj by his masters and he dies before being freed, then his Hajj is complete. But if he is freed before dying, then he should (perform Hajj) again. And if a child is made to perform Hajj by his family and he dies before Hajj becomes obligatory upon him, then his Hajj is complete, and if he reaches maturity, then he should (perform Hajj) again."
Hadith Referenceمسند الإمام الشافعي / كتاب الحج / 941