This sentence is quoted from a director's memoir, where he mentions that a famous movie star was sent to the police station because of his affair. (Thank all of you for your considerate answers. To specify this question, I'll provide the full paragraph for context)
When we got back to Munich for the interior shots, he turned into a boy; he played. Living with me in the magnificent Vier Jahreszeiten Hotel, Freddie got into trouble with a chambermaid, and late one night I had to rush to the police station and intercede for him. He was being threatened by the chambermaid’s husband; this unreasonable man was out to become famous by killing a movie star. Freddie was a child who couldn’t keep his fingers out of the cookie jar.
I used to interpret the phrase "keep one's fingers out of the cookie jar" as "resist temptation without making mistakes" (similar to "someone's hand got caught in the cookie jar.")
But today my friend told me that here, "the cookie jar" has a sexual connotation that refers to the genitals. So what is the meaning of the phrase in this context? What might have happened to this star?