Yahya related to me from Malik from Ibn Shihab from Haram ibn Sad ibn Muhayyisa that a female camel of al-Bara ibn Azib entered the garden of a man and it did some damage to it. The Messenger of Allah ﷺ gave a judgement that the people of the garden were responsible for guarding it in the day, and the owner of the animals was liable for what the animals destroyed at night.
أَنَّ نَاقَةً لِلْبَرَاءِ بْنِ عَازِبٍ دَخَلَتْ حَائِطَ رَجُلٍ فَأَفْسَدَتْ فِيهِ فَقَضَى رَسُولُ اللَّهِ ﷺ أَنَّ عَلَى أَهْلِ الْحَوَائِطِ حِفْظَهَا بِالنَّهَارِ وَأَنَّ مَا أَفْسَدَتِ الْمَوَاشِي بِاللَّيْلِ ضَامِنٌ عَلَى أَهْلِهَا