Chārudatta is a generous young man who, through his charitable contributions to unlucky friends and the general public welfare, has severely impoverished himself and his family. Though deserted by most of his friends and embarrassed by deteriorating living conditions, he has maintained his reputation in Ujjayini as an honest and upright man with a rare gift of wisdom and many important men continue to seek his counsel.
Though happily married and the recent father of a young son, Rohasena, Chārudatta is enamored of Vasantasenā, a courtesan of great wealth and reputation. At a chance encounter at the temple of Kāma she returns his affection, though the matter is complicated when Vasantasenā finds herself pursued by Samsthānaka, a half-mad brother-in-law of King Pālaka, and his retinue. When the men threaten violence, Vasantasenā flees, seeking safety with Chārudatta. Their love blossoms following the clandestine meeting, and the courtesan entrusts her new lover with a casket of jewelry in an attempt to ensure a future meeting.
Her plan is thwarted, however, when a thief, Sarvilaka, enters Chārudatta’s home and steals the jewels in an elaborate scheme to buy the freedom of his lover, Madanikā, who is Vasantasenā’s slave and confidant. The courtesan recognizes the jewelry, but she accepts the payment anyway and frees Madanikā to marry. She then attempts to contact Chārudatta and inform him of the situation, but before she can make contact he panics and sends Vasantasenā a rare pearl necklace that had belonged to his wife, a gift in great excess of the value of the stolen jewelry. In recognition of this, Chārudatta's friend, Maitreya, cautions the Brahmin against further association, fearing that Vasantasenā is, at worst, scheming to take from Chārudatta the few possessions he still has and, at best, a good-intentioned bastion of bad luck and disaster.
Refusing to take this advice, Chārudatta makes Vasantasenā his mistress and she eventually meets his young son. During the encounter, the boy is distressed because he has recently enjoyed playing with a friend's toy cart of solid gold and no longer wants his own clay cart that his nurse has made for him. Taking pity on him in his sadness, Vasantasenā fills his little clay cart with her own jewelry, heaping his humble toy with a mound of gold before departing to meet Chārudatta in a park outside the city for a day’s outing. There she enters a fine carriage, but soon discovers that she is in a gharry belonging to Samsthānaka, who remains enraged by her previous affront and is madly jealous of the love and favor she shows to Chārudatta. Unable to persuade his henchmen to kill her, Samsthānaka sends his retinue away and proceeds to strangle Vasantasenā and hide her body beneath a pile of leaves. Still seeking vengeance, he promptly accuses Chārudatta of the crime.
Though the Chārudatta proclaims his innocence, his presence in the park along with his son's possession of Vasantasenā's jewels implicate the poverty-stricken man, and he is found guilty and condemned to death by King Pālaka. Unbeknownst to all, however, the body identified as Vasantasenā’s was actually another woman. Vasantasenā had been revived and befriended by a Buddhist monk who nursed her back to health in a nearby village.
Just as Chārudatta faces execution, Vasantasenā appears and, seeing the excited crowd, intervenes in time to save him from execution and his wife from throwing herself onto the funeral pyre. Together the three declare themselves a family. Reaching the courts, Vasantasenā tells the story of her near death and, following her testimony, Samsthānaka is arrested and the good Prince Āryaka deposes the wicked King Pālaka. His first acts as the newly declared sovereign is to restore Chārudatta’s fortune and give him an important position at court. Following this good will, Chārudatta demonstrates in the final act his enduring virtue and charity, appealing to the King for pardon on behalf of Samsthānaka who is subsequently declared free.

Question: How is Samsthanaka freed?
Answer: Charudatta appeals to the king on his behalf.