 Harry , Ron , Ginny , and Lockhart return to the main castle and reunite with McGonagall , Dumbledore , and Mr. and Mrs. Weasley . Ginny , whose entrancement by Voldemort caused all of the petrification and troubles over the course of the year , is given a reprieve by Dumbledore , who reasons that greater wizards have been duped by Voldemort before and takes great interest in the qualities of the diary , which Harry gives to him . Lucius Malfoy bursts in after this meeting , demanding to know why and how Dumbledore has returned to the school and accompanied by Dobby , revealing the family to whom he is enslaved . The house @-@ elf also provides Harry with unspoken cues regarding the diary ’ s ownership : While it was Tom Riddle ’ s , it had been in the Malfoys ’ possession , and Harry returns it , devising a scenario involving his own sock that frees Dobby from the Malfoys ’ employment . The petrified students are cured , the end @-@ of @-@ year exams are cancelled ( much to Hermione ’ s chagrin ) , Hagrid comes back in the middle of the final feast , and Harry returns to Privet Drive in higher spirits than he last left it . 
