Segmentation Fault help!!!!

I wrote a class that uses boost library to create thread. My thread function just do select operation for mysql database. Besides, I developed a client program to test server side, but server side gave 'segmentation error ' after fourth client request via socket.

First thing to try is just letting it run, then use the 'bt' command to get a stack trace at the point it segfaults.
Then read the help to figure out how to examine variables, set breakpoints for future runs etc etc.

2. I notice a lack of error checking, particularly with regards to result.