Is it legal to add freon to a leaking air conditioner?

It's less a question of legality than whether it is prudent. Due to current regulations, air conditioning systems can only be recharged by individuals licensed to purchase and handle refrigerants, and some refrigerants, particularly R12 and R22 for older systems (the kind that are more likely to be leaking) have become very pricey. Recharging a system can easily run $200 and up these days. It would make more sense to first locate and repair the leak before recharging the system.

In the alternative, one can convert a system to use a refrigerant that doesn't require licensing to purchase and use, such as Duracool, which is essentially highly refined propane, the same stuff that we use for barbecues and to heat and cook in recreational vehicles and houses that aren't connected to a city gas supply. Such non-chlorinated refrigerants are 100% compatible with the materials and lubricants used in R12, R22 (CFC) and R134a (HCFC) systems, and can be substituted with improved efficiency, requiring about half as much refrigerant as the CFC or HCFC they replace for the same cooling effect. If there is a leak, it would need to be repaired, since Duracool and similar refrigerants are flammable. On the positive side, they are environmentally friendly, non-toxic, and just like cooking gas, they have an odorant added so that one can detect leaks by smell.

Safety note: If your current, leaky system uses R134a and you find that the leak is inside the living space, get it fixed now, or have a technician evacuate and "mothball" the system now! R134a, when exposed to a flame, such as from a candle, a cigarette or a gas range, decomposes into phosgene gas, which can be deadly if inhaled in sufficient amounts.