In Harry Potter and the Chamber of Secrets, Harry frees the house-elf Dobby. Dobby initially tries to keep Harry away from Hogwarts because he knows that the Chamber of Secrets has been reopened.
Dobby is bound to serve the Malfoy family. Harry tricks Lucius Malfoy into giving Dobby a sock hidden inside Tom Riddle’s diary; accepting the clothing breaks the magical bond and makes Dobby free.
The sock scene is an important early example of Harry opposing the treatment of house-elves. Dobby later returns in several films, while Kreacher belongs to the Black family and Winky is associated with the Crouch family.