It's a symptom of being human that we don't reveal everything to everyone. Some of us don't reveal anything to anyone! But even if you're not a paranoid wreck who believes that someone could use the knowledge you need bread and milk against you there's got to some things you keep to yourself.
Characters are the same.
It happens more in television, I suppose. Soap operas are renowned for people spilling their darkest secrets over a drink to the person who just moved in next door. Of course, that person was always angling for the information anyway because they're a long-lost relative out for revenge for an incident with petrol and a box of matches years ago... for instance. They need to tell the secret because the plot needs to progress and on screen it's much easier to go down the route of a confession. Yes, you can certainly show rather than tell on television but inner turmoil is something much harder to portray. I'm not denying there are some exceptional actors out there but there are indubitably some flops too.
What you have to bear in mind whenever your character reveals anything - be it in a script, short story, novel, whatever - is they must have a reason for disclosing that information right at that moment.
Is he the type of person to open his mouth before he thinks about it? Fine, but make sure that isn't a conveniently placed character trait that won't appear again.
Is she the type to hold back her surname for fear people may know her family? Okay, so don't have her introducing herself as Stella Cricks at a gala then gushing about her relatives to all and sundry.
It comes back to the old adage about knowing your characters. However, you must trust your reader as well. If a character is lying for whatever reason you don't have to highlight it at the time - if it's a mystery you're writing that'll kill off all suspense faster than you can draw a big glaring line. Trust that an untruth will stalk your characters and don't contrive ways for them to tell the audience things they should be able to work out on their own.