depends where the leak is. if it's from the flow valve, you can replace the valve or attempt to fix it. but it depends what's wrong with it. I had one that completely seized up and would vent.
if it's from the main seal, bottom, there are a few things you can try to do. you can try to get a replacement main seal, you can try to give it a silicon oil bath to swell it up, or you can try to teflon tape it. some mags can be fixed by simply tightening the screw on the bottom to force the seal to work. other mags like the mk23 are held closed with retaining pins instead and take a little more effort to seal.
before buying a used gun, make sure you can locate mags for it. especially if it's not a mainstream pistol.