Pulling less weight is entirely subjective. First, he may be doing more than you think (there are other things besides code check-in that contribute to a project). Next he may be less skilled and thus have lower expectations from management and be assigned to those crappy tasks nobody else wants to do but still need to be done. Third why do you care if he gets credit if he worked on the project too? It is none of your business. Fourth maybe no one has the time to mentor him in the middle of meeting a tight deadline. Fifth, he may have something else that is causing him to be delayed in what he is doing that is outside of his control.
Or he may be doing less due to a personal problem (like say a cancer diagnosis) and less repsponsibility is something worked out with the manager which would likely remain confidential and you would not be told.
Nor are you aware necessarily of what management may be doing to improve his performance if there is a real performance problem. It takes time to get rid of someone and in a crunch management may make the choice that the small contribution is better than the no contribution they would get if they fired the guy because they couldn't get someone new in to replace him in time.
Of course, management may love him because he is taking the credit for what other people do because he is competent at office politics and the rest of the team is not.
Or maybe he is there for a reason you can't get past like being the son of the CEO's college roommate. People like that know they don't have to pull their weight and why shoudl they waste the energy?
So what do you do? First if there is a genuine performance problem, you need to bring it up sooner rather than later. If his slowness or inability to produce is causing delays for others, then bring up the delay (not his performance specifically) and ask management to get him some help so that your work is not affected. You say managemnt doesn't know he is not pulling his weight. Well why don't they know? Did you and your team mates forget to mention the problems he is causing? If he is not causing any problems or delays why do you care that he only produced one module for the the ten you did.
If the problem is that he doesn't work the same crazy hours you work, then examine just why you think you have to work those hours.
If the problem is that you just don't like him, the problem could be your attitude. Does he have trouble getting cooperation from others on the team?
And what have you done to try to help him improve? Have you mentored him? Have you even asked him if he needs help or what the problem is? Have you suggested things like code review for everyone as a way to get his skills up to snuff? If management sits in on these code reviews and everyone else does well and his stuff always fails, they wil realizxe soon enough how poorly he is performing. If you point out the problems with his code then he can learn better constructs and imporve his performance. And if it doesn't get better that too will become obvious to everyone and steps to get rid of him can be taken.
And as for the political side, people can't take credit for your work when you already have. No one in the work world can afford to not understand or play office politics. You are in the game whether you want to be or not and not trying to play gives the creeps an easy target for the credit grabbing game. Why would you want to give an easy win to a snake? And if the politics dictate he will be there no matter what, then make friends with the guy and get him to push for you instead of being his enemy.
And if he is just too lazy to do his job, then a few pointed remarks where a manager can hear about checking Facebook or playing games while such and such is already late can work wonders. Peer pressure often will keep these people in line and if it doesn't, then ask management directly to get rid of him after you have proof that he is is not pulling his weight.
Someone who won't improve after code reviews and peer pressure and being talked to directly and having his delays aired in meetings is someone who can't be fixed and needs to go. But sometimes management won't hear that until the most respected memeber of the team points out the morale issue of keeping such a person. Because managers are people too and it isn't fun to fire people. But finding out that your other team members are negatively affected especially to the point of leaving can be the deal breaker. If someone is leaving, ask them to mention the problem in their exit interview.