As long as the leak has been stopped and the drywall is completely dry without structural damage, it is okay to paint over water-damaged walls. There are specialized paints available for these situations that create a waterproof barrier and prevent the stain from returning.