I would like to complete the other answers with quotes from the book Smaug: Unleashing the Dragon made by Weta Workshop:
SIX LIMBS OR FOUR?
For Peter, it is never too late to have a good idea. The brief for Smaug came in hints and clues: he was huge, he was incredibly old and maleficient. Red-gold, as Tolkien described. Winged. Fire-breathing. Hundreds of dragonsdesigns were done and a design for the Dragon was completed, buildbuilt and glimpsed in the first film.
You might think we were done, but Peter decided that he should have two legs instead of four. Back to our drawing boards we went, but most happily as it turns out. In the design that emerged Smaug was stronger in every way, with wing 'hands' that became much more expressive, and a more aerodynamic and powerful silhouette.
John Howe, Concept Art Director
The next page in the book explainexplains a bit more the changes in the design:
[...] When standing he was starting to look too much like a bulldog.
At some point, Peter asked about whether we should in fact be rethinking the anatomy entirely and consider exploring a creature that was much more snake-like, with only two legs. [...] Peter was looking for ways to involve [the wings] in the acting and use them to help convey emotion.
My book is in a cardboard box so I had to watch book review videos to get the quotes. Since these are blurry, I might have got some words wrong. The passagesThe excerpts quoted can be seen here (0:25)
It might also worth noting that they fixed the legs in the extended edition of the first movie:
Source: Dragons vs Wyverns: The Question of Smaug
So as explained in the other answers, it was not an error but a change in the design choice.