One component of the locking mechanism is a change in the shape and size of the femoral surfaces that articulate with the tibia:
In flexion, the surfaces are the curved and rounded areas on the posterior aspects of the femoral condyles.
As the knee is extended, the surfaces move to the broad and flat areas on the inferior aspects of the femoral condyles.
Consequently the joint surfaces become larger and more stable in extension.