Bug #1979 mysql_realconnect crashes
Submitted: 28 Nov 2003 6:32 Modified: 1 Dec 2003 14:38
Reporter: Fabrice Marchal Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:4.1 OS:Cygwin 1.5.5
Assigned to: CPU Architecture:Any

[28 Nov 2003 6:32] Fabrice Marchal
Description:
I dont know if this is a problem of mysql, g++ or
cygwin but the following simple code keeps crashing with g++3.3.1
Platform: cygwin-1.5.5, mysql 3.23 and mysql 4.1 as well
Note that the code does not crash if all the mysql_ calls are
made from inside the "main()" block. GDB reports that the crash occurs 
when returning from the Connection() constructor.

How to repeat:
#include "mysql.h"
#include <iostream>

using namespace std;

class Connection{
  MYSQL *mysql;
public:
  Connection(){
	mysql = mysql_init( NULL );
	if( mysql == 0 ){
		cerr << "failed to init" << endl;
		exit(-1); }
	mysql_real_connect( mysql, "", "", "", "test", 3306, NULL, 0);
  }
};

int main( int argc, char** args ){
	Connection con;
}
[28 Nov 2003 9:54] Dean Ellis
Is this not the same basic issue as you have reported in bug #1859?
[1 Dec 2003 6:15] Fabrice Marchal
Yes it is the same bug, I have just cornered the problem a bit more.
[1 Dec 2003 14:38] Dean Ellis
Flagging it as a duplicate, and moving the comments to #1859.  Please stay with the original report rather than creating a new item for the same issue.

Thank you.