If you can do them without pain, then great. But, if you have knee problems, then don't do them. These really put stress on the patellar tendon. The knee works best when weight is put on the knee. When the leg extension, the joint does not have weight pressed on it from the foot to the knee, because you are only bending it.
Weight helps to compress the knee to keep it stable.
That is my observation, I could be wrong. Never lock your knees. If you do, when lifting you can actually over-extend your knees, which will possibly tear cartilage or ligaments. You do not want to do this. I see almost every beginner locking his or her knees on the leg press.