All perfect praise be to Allah, The Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad, sallallahu ‘alayhi wa sallam, is His slave and Messenger.
If what you did, telling this man and his wife of the harm inflicted on the child by this woman, was to ward off the harm from the child and achieve benefit, then this is not prohibited; rather, you shall be rewarded for it, Allah willing, because this is a form of giving sincere advice. ‘Abdullah ibn Mas‘ood, may Allah be pleased with him, said:
"After the battle of Hunayn, the Messenger of Allah, sallallahu ‘alayhi wa sallam, favored some people in the distribution of the spoils of war (as a consolation). He, sallallahu ‘alayhi wa sallam, gave Al-Aqra‘ ibn Haabis and ‘Uyaynah a hundred camels each and also favored some noblemen among the Arabs. A man remarked, 'By Allah, this division is not based on justice, and it was not intended to win the Pleasure of Allah by it!" I said to myself, 'By Allah! I will inform the Messenger of Allah, sallallahu ‘alayhi wa sallam, of this.' So I went to him and informed him..." [Al-Bukhari and Muslim]
Ibn Mas‘ood informed the Prophet, sallallahu ‘alayhi wa sallam, in order to eliminate a potential evil, and this is why the Prophet, sallallahu ‘alayhi wa sallam, did not disapprove of it. Ibn ‘Allaan wrote, "His statement, 'I will inform the Messenger of Allah of this,' so that he, sallallahu ‘alayhi wa sallam, would be cautious of that man and what he was hiding in his heart. It was not intended as talebearing and disclosure of the secrets of the gathering, which are a trust that should be guarded. On the contrary, his intention was to convey sincere advice for Allah; His Messenger, sallallahu ‘alayhi wa sallam; and the believers." [Daleel Al-Faaliheen]
Ibn Daqeeq Al-‘Eed wrote, "Talebearing may be allowable if refraining from it causes harm to other people or if doing it brings forth benefits without which others would be harmed ... If someone heard a person say something that entails harming another person, then it is obligatory to convey what he heard to him so that he would take precautions to avoid the harm." [Ihkaam Al-Ahkaam]
Allah knows best.