Hermione used the spell Finite Incantatem to make the rogue bludger stop attacking Harry. The bludger had already attacked Harry once, causing him to be knocked off his broom but continued to try to hurt him. Therefore, Hermione used the spell-blocking curse to prevent the magic of whoever was bewitching the bludger from stopping. It is later found out that it was Dobby, the house-elf, who was tampering with the bludger as he was concerned for Harry's safety and wanted to hurt Harry enough to send him home, away from Hogwarts.