A note to the reader:

I posted this question because I felt that something more needed to be done than I had already done. I was wrong. After a spirited, but civilized debate, a definitive answer was posted by moderator Ed Cottrell. I wish to bring to your attention the following portion of that answer (emphasis added):

... the best solution is just go ahead and edit it yourself. In this case, the author of the post didn't mind your edit, so this really was the best solution.

I respectfully request that we leave it that, and drop the matter. And my apologies to KemyLand, since it has become abundantly clear to me that no harm was intended, and that KemyLand is a person of extraordinary character. I hope you will show the support and respect that KemyLand deserves.

What is the correct course of action when a user posts malicious code as a joke?

Here's the answer that is the source of my concern. In the first version of the answer, the author provided a complete set of code that could be compiled and run. If any user was foolish enough to actually run the code, the code would attempt to wipe their hard drive.

I edited the answer to replace the malicious line of code with something harmless, and the author accepted that change. However, in the discussion that followed, it's clear that the author is unrepentant, and does not appreciate the gravity of the situation.

Having lost a hard drive to a mechanical failure, I can tell you that it is a catastrophic event to lose a hard drive that isn't fully backed up. So I feel that it's beyond irresponsible for the author to post that code. And I think the author of that post needs to be corrected.

What is my correct course of action at this point?

Edit: Based on Servy's answer and the discussion between Servy and Carpetsmoker, it seems that the question comes down to this: Is it useful to flag the post for moderator attention? Assuming that the flag is declined, does flagging provide useful information to the mods. Will a series of similar flags against a single user expose a pattern of behavior. Or will each flag be declined, and then forgotten?