Only a lawyer can answer this question. But, very relevant are fair use and whether a small snippet of code is copyrightable.
Also, the implicit license it was posted under is relevant when asking a lawyer their opinion. A lawyer might say that it would be difficult for someone to reasonably argue that their copyright was violated when code they post in response to a question is used in any way. Legal concepts such as promissory estoppel might come into play. It would also be interesting to see if reputation points could be deemed "consideration" under the law.
Patent issues are a much bigger risk, because the patent law is so nonsensical and keeps getting worse. Software patents are very dangerous and have already caused great damage to the software industry and free software.
Also, export restrictions (e.g. ITAR) are very dangerous, although some important precedents protecting source code as speech have been set. There was a time when simply having hooks to process data before sending it on its way was restricted as a munition in the US.