segfault in malloc_consolidate ??
Ouch, I have no idea where to go from here.
The line that generates this error is trying to open a connection to mysql on the localhost. This connection has been successfully opened before; in fact, this is the second time through the loop, and the first execution of the loop executed flawlessly. This exact error occurs every time there is a second iteration of the loop. I double-checked to make sure that the connection is closed before it is reopened. Here is output from gdb: Code:
2018 if( !mysql_real_connect( &conn_temp, server, mysqlUser, mysqlPass, mysqlDB, 0, NULL, 0 )) { TIA! |
Check your loop. If it works the first time, it's likely you forget to "undo" something you did the first time through the loop. I don't use mysql, but my first guess is to make sure that you close the existing mysql connection before you try to connect to it again (using the same data structures, etc.). Usually there are data structures the library needs to keep track of how things are working. The open/connect functions expect those data structures to be initialized to know values, and that's usually what the close/disconnect functions do: they free any used memory and re-initialize the data structure.
That kind of problem has caused me grief before. It may not be the answer to your problem, but it's worth investigating. |
Hello Dark_Helmet,
Thanks for the reply. You are right on target with your observation. A mysql session starts with mysql_init( &context ), where context is a MYSQL structure that holds all the info about the session. The connection is made to the server with mysql_real_connect( ) and passing such things as a reference to the MYSQL structure, user name, server, etc. The MYSQL structure is wiped and previous connections made with the structure are closed with mysql_close( &context ). I believe that I have closed everything before trying to reopen it. If you would be willing to check the problem loop, I have posted it at http://zaichik.org/loop.txt (if it's not kosher to post it in links, let me know and I will post it here). In my test case, all occurences of target_mac[ ] are empty strings, and ip_is_bound() will return 0. If you have the time, I would really appreciate a second pair of eyes on this (or third, fourth, fifth)... Thanks again! |
Actually, I decided to go ahead and post the code. For posterity. Pardon its length.
Code:
while( row = mysql_fetch_row( res )) { |
All times are GMT -5. The time now is 10:48 AM. |