That's a good thing to keep in mind for the future. :) Rescues, especially larger rescues, will almost always gladly take leftover medications for standard conditions, or things like medicated shampoos. Every good rescue I know works closely with their vets -- usually several of them -- and would be well familiar with the meds they commonly can use (eg heart meds, painkillers, and so on). Most have vets who trust them to do vaccinations and so on as well and know they can responsibly and knowledgably manage basic and common pet medications. :)
With hindsight I wish I had not given it to them and contacted a local cats rescue myself!