That should be a "hanger bolt", with screw threads on one end and bolt threads on the other. If it's really bent you could unscrew it from the leg and install a replacement.
Find a piece of pipe that is very similar to the outside diameter of the bolt. Slide over bolt, and SLOWLY AND CAREFULLY bend straight. You could PROBABLY get away with using pliers, but you might damage the thread.
Put the nut on and screw it all the way to the leg before bending the bolt. That way, if you do accidentally damage the thread you are better able to force it back into shape by unscrewing the nut with a spanner.