MDEV-7883 Segmentation failure when running mysqladmin -u root -p

take into account that argc can be 0
(if there were no commands on the command line)
This commit is contained in:
Sergei Golubchik 2015-04-25 21:56:46 +02:00
parent 18215dd9fa
commit 053143efe1
2 changed files with 9 additions and 0 deletions

View File

@ -1198,6 +1198,9 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
static char **mask_password(int argc, char ***argv)
{
char **temp_argv;
if (!argc)
return NULL;
temp_argv= (char **)(my_malloc(sizeof(char *) * argc, MYF(MY_WME)));
argc--;
while (argc > 0)

View File

@ -45,3 +45,9 @@ EOF
--exec $MYSQLADMIN --defaults-extra-file=$MYSQLTEST_VARDIR/tmp/cnf_file -uroot -S $MASTER_MYSOCK -P $MASTER_MYPORT ping 2>&1
--remove_file $MYSQLTEST_VARDIR/tmp/cnf_file
#
# MDEV-7883 Segmentation failure when running mysqladmin -u root -p
#
--error 1
--exec $MYSQLADMIN -u root -p 2>&1 > /dev/null