List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:September 26 1999 10:50pm
Subject:mysql_real_connect with NULL pointer
View as plain text  
>>>>> "TOMITA" == TOMITA Masahiro <tommy@stripped> writes:

>> Description:
TOMITA> 	In manual, mysql_real_connect()'s first parameter can be NULL.
TOMITA> 	Is it true?  The following sample program is core dumped.
TOMITA> 	In client/libmysql.c, mysql_real_connect() use mysql pointer
TOMITA> 	without initialize.

>> How-To-Repeat:
TOMITA> 	% cat aa.c
TOMITA> 	#include <mysql.h>
TOMITA> 	#define NULL 0
TOMITA> 	main()
TOMITA> 	{
TOMITA> 	  mysql_real_connect(NULL, NULL, NULL, NULL, NULL, 0, NULL, 0);
TOMITA> 	}
TOMITA> 	% gcc aa.c -I/usr/local/include/mysql -L/usr/local/lib/mysql -lmysqlclient

TOMITA> 	% ./a.out
TOMITA> 	Segmentation fault (core dumped)

>> Fix:
TOMITA> 	Document bug?

Hi!

This documentation bug is already fixed in the online manual;  You
can only use NULL with mysql_init() and mysql_connect(); Not with
mysql_real_connect().

Regards,
Monty
Thread
mysql_real_connect with NULL pointerTOMITA Masahiro26 Sep
  • mysql_real_connect with NULL pointerMichael Widenius27 Sep