Turn the sofa onto its back and remove the legs. You will probably need someone to help you with this to avoid further damage to the legs. The legs will either be screwed into the sofa or they will be attached to the sofa with a bracket and screws. Determine exactly what part of the leg, the leg itself or the bracket, is damaged. Unscrew the legs or use a screwdriver to remove the bracket and legs.
Repair the legs. When the hanger bolt of a screw-in leg is bent, straighten it by using pliers. If necessary, straighten the hanger bolt by hitting it with the hammer. When the bracket is bent, straighten it by using the hammer.
Replace the legs. When the damage is to the leg itself and not the attachment hardware, repairing the leg is impractical. The legs of a sofa bear a great deal of weight, and a repaired leg would be subject to breaking again. Obtain enough new sofa legs to replace all of the old ones, not just the broken one. Choose legs that have the same attachment method as the old ones. Screw the new legs into place for screw-in legs. Attach new bracket legs to the old locations by lining up the screw holes in the new brackets. Set the sofa on its new legs with the help of a friend.