It's a massive safety hazard, so no locked doors around here at night.
I do understand your concerns - I don't trust my toddler to be out of sight for very long either!
We do have a child safety gate on DS's room. He's still in a cot at the moment but he'll be in a big boy bed soon so we're prepared. His bedroom is perfectly safe for him to play in unsupervised (at least until he wakes us up). I'd rather contain him in there than lock the doors.