I think comedy can be a criticism of life, certainly, although there is comedy that is not. Very "broad" comedy appeals to our funny bones in a different kind of way, much like the difference between our appreciation of witty repartee in a film as opposed to our laughter at the very physical comedy of something like the Three Stooges. Some comedy is meant simply to entertain us and nothing more. There are many examples in literature, though, of comedy that is meant to critique or comment on some aspect of life.
I just finished reading Bill Bryson's latest book, The Road to Little Dribbling. Like most of his books, this one is filled with humorous criticism—in this case, of his adopted country, the United Kingdom. He pokes fun at British things in a very entertaining way, but the reader can see these are aspects of British life of which he is genuinely critical. What keeps Bryson from being just a grumpy old man is that he never hesitates to make fun of himself, too, which is, I suppose, a criticism of life.
In a far older example, Chaucer's The Canterbury Tales uses humor to comment on and criticize the society of his time and place, particularly the Church. The hypocrisies of the day are exposed, as these travelers on their spiritual quest are far more concerned with matters such as lust and wealth.
Catch-22 by Joseph Heller is a comedic critique of society, in particular military bureaucracy. The term "catch-22" did not take very long to catch on in its day, since the pointed humor of the novel resonated with anyone who had any experience of bureaucracy.
There is no question that there is comedy in literature that is meant to just entertain, but much comedy in literature is meant to make a point that critiques some aspect of life.