Kindly refer to the following link(s):
If I Urinate or pass wind between Ghusl, do I have to start over again?
If a person passes wind while making wudu, must he start wudu from the beginning?
If one passes wind or urinates during ghusl, must he redo ghusl or redo the wudu?