diff options
author | Tatiana A. Nurnberg <azundris@mysql.com> | 2009-11-02 00:46:00 -0800 |
---|---|---|
committer | Tatiana A. Nurnberg <azundris@mysql.com> | 2009-11-02 00:46:00 -0800 |
commit | 1b0be8c5b8b419419867b29014d36503404c66b3 (patch) | |
tree | 2773ca1f2852f0bbe6417adc9eb2e10e966f844c | |
parent | 6ceaf234bb9fa2e521c67568e1bd6f76ac890ee2 (diff) | |
download | mariadb-git-1b0be8c5b8b419419867b29014d36503404c66b3.tar.gz |
Bug#47655: Memory free error when connecting to 4.1 server from 5.1+ client
When starting the (5.1+) mysql command-line client, we try to get
"select @@version_comment" from the server to present it to the
user. Recent clients are aware that older servers do not have that
variable and fall back on other info to be able to present *something*
at least. This fallback string was allocated through the POSIX interface,
but released through the my*() suite, which rightfully complained about
the imbalance in calls when compiled with --debug. While this wasn't
as bad as it looked (no double-free, use of uninitialized or freed
buffer, etc.), it did look funky.
Using my_strdup() now for what will be my_free()d later.
client/mysql.cc:
Use my_strdup() for server_version, as we'll my_free() it later
and don't want to upset the mysql client's memory accounting.
-rw-r--r-- | client/mysql.cc | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index b76a3d624ab..4f9aef411ca 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -4474,9 +4474,7 @@ server_version_string(MYSQL *con) */ if (server_version == NULL) - { - server_version= strdup(mysql_get_server_info(con)); - } + server_version= my_strdup(mysql_get_server_info(con), MYF(MY_WME)); } return server_version ? server_version : ""; |