A surviving Mali requires several things:
1)Internal change in the Mali state: the sultans (Mansas) of Mali relied too much on tribal loyalties. A centralized government in direct control of the people is required (possible but will take time).
2) Prevent succession crisises. Heirs to the throne of Mali fought each other on too many occasions, ripping the Empire apart in the process. Creating an official and respected line of sucession creates less civil wars and more internal stability.
3)Islam needs to do better at spreading amongst commoners. It would be beneficial to Mali if all of its people were literate and unified by a national religion and language (Arabic).
4) Destroy Songhai and Mossi culture. These two groups are Mali's only significant outside political threats. Destroying these groups languages and cultures while assimilating them into the empire would secure Mali from foreign invasion.
5)Now as to the OP'S question. If Mali can survive intact with its peak borders well into the 15th century, then it can trade mor firearms and gunpowder via slaves. Eventually they will be fully capable of producing their own muskets (several African states in otl did this to a limited extent I believe). However, I do not know if Mali has the natural resources to make its own gunpowder but I'm sure that the stuff can easily be traded for.