Continuity mistake: In the scenes where Harry & Ron are trying to get away from the spiders, the car windshield goes from not being broken to being broken constantly, from the time it comes over the hill to when it drops them off at school.
Continuity mistake: When Harry drinks the Polyjuice potion you can see his hand, but in the next shot his robe sleeve is over his hand.
Continuity mistake: During breakfast at the Weasleys, when Mr. Weasley asks, "What is the function of a rubber duck?" Ron turns his head toward Harry waiting for his response, but in the next shot Ron is looking down at his food, before they all turn their heads to look out the window at Errol.
Continuity mistake: Tom Riddle's uniform tie is different to the current ties in the first two Harry Potter films. Yet it matches the style of the students ties in the rest of the films. The mistake here is that Tom Riddle (at school) was before Harry's time at Hogwarts, but I guess when the costume department changed the ties, they didn't realise they should give Tom Riddle an older one as per the first two films.
Continuity mistake: When Snape yells Expelliarmus and shoots it at Lockhart, he puts his left hand behind him. But, on the next overhead shot, his left hand is now stretched out to the side of him.
Continuity mistake: When Harry has Tom Riddle's diary and starts writing into it, he writes "My name is Harry Potter". You can see by the way he writes it he doesn't put a full stop (period) at the end of the sentence. But in the next shot of the diary, there suddenly is a full stop there.
Continuity mistake: Hermione tells Harry and Ron to grab the robes after they pass out, but the next scene she has Slytherin robes from the laundry.
Continuity mistake: When running from Aragog, there is one quick shot of the back of the Anglea and the hole that was punched into the back window by the Whomping Willow has vanished to return only a few seconds later.
Answer: Yes. It's a common occurrence in a lot of movies for actors to forget their original lines so they improvise something to help move the scene along and not break character. Tom did this because he forgot what his original line was.