diff options
author | unknown <monty@mysql.com> | 2006-03-23 00:37:40 +0200 |
---|---|---|
committer | unknown <monty@mysql.com> | 2006-03-23 00:37:40 +0200 |
commit | 3e6330e78343276a909fec866dc8e07f736e8900 (patch) | |
tree | eea49c98b127757ba28345866f879e6f64e675ec /sql-common | |
parent | dec3dff235c538d3490c3d82c8c79bccc7d17420 (diff) | |
download | mariadb-git-3e6330e78343276a909fec866dc8e07f736e8900.tar.gz |
Make usage of the MYSQL struct in shared libraries compatible with MySQL 5.0.17 and
5.0.18 by not reseting or accessing the info_buffer member
Diffstat (limited to 'sql-common')
-rw-r--r-- | sql-common/client.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sql-common/client.c b/sql-common/client.c index 2d826df0662..4c7ef3fcd03 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1428,7 +1428,13 @@ mysql_init(MYSQL *mysql) mysql->free_me=1; } else - bzero((char*) (mysql),sizeof(*(mysql))); + { +#if defined(EMBEDDED_LIBRARY) || MYSQL_VERSION_ID >= 50100 + bzero((char*) (mysql), sizeof(*(mysql))); +#else + bzero((char*) (mysql), offsetof(MYSQL, info_buffer)); +#endif + } mysql->options.connect_timeout= CONNECT_TIMEOUT; mysql->last_used_con= mysql->next_slave= mysql->master = mysql; mysql->charset=default_charset_info; @@ -2341,9 +2347,12 @@ static void mysql_close_free(MYSQL *mysql) my_free(mysql->user,MYF(MY_ALLOW_ZERO_PTR)); my_free(mysql->passwd,MYF(MY_ALLOW_ZERO_PTR)); my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR)); +#if defined(EMBEDDED_LIBRARY) || MYSQL_VERSION_ID >= 50100 my_free(mysql->info_buffer,MYF(MY_ALLOW_ZERO_PTR)); + mysql->info_buffer= 0; +#endif /* Clear pointers for better safety */ - mysql->info_buffer=mysql->host_info=mysql->user=mysql->passwd=mysql->db=0; + mysql->host_info= mysql->user= mysql->passwd= mysql->db= 0; } |