Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 2 memory leaks in libmariadbclient #2623 #2625

Merged
merged 1 commit into from
Apr 1, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 23 additions & 7 deletions deps/mariadb-client-library/mariadb_lib.c.patch
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,23 @@

if (mysql->client_flag & CLIENT_COMPRESS)
net->compress= 1;
@@ -1647,7 +1654,7 @@
@@ -1568,6 +1575,15 @@
return(mysql);

error:
+ // fix for proxysql bug #2623
+ if (mysql->net.extension) {
+ free(mysql->net.extension);
+ mysql->net.extension=NULL;
+ }
+ if (mysql->extension) {
+ free(mysql->extension);
+ mysql->extension=NULL;
+ }
/* Free alloced memory */
end_server(mysql);
/* only free the allocated memory, user needs to call mysql_close */
@@ -1647,7 +1663,7 @@
if (!mysql_real_connect(&tmp_mysql,mysql->host,mysql->user,mysql->passwd,
mysql->db, mysql->port, mysql->unix_socket,
mysql->client_flag | CLIENT_REMEMBER_OPTIONS) ||
Expand All @@ -24,23 +40,23 @@
{
if (ctxt)
my_context_install_suspend_resume_hook(ctxt, NULL, NULL);
@@ -1693,6 +1700,7 @@
@@ -1693,6 +1709,7 @@
{
if (mysql->stmts)
{
+/*
LIST *li_stmt= mysql->stmts;

for (; li_stmt; li_stmt= li_stmt->next)
@@ -1701,6 +1709,7 @@
@@ -1701,6 +1718,7 @@
stmt->mysql= NULL;
SET_CLIENT_STMT_ERROR(stmt, CR_STMT_CLOSED, SQLSTATE_UNKNOWN, function_name);
}
+*/
mysql->stmts= NULL;
}
}
@@ -1970,6 +1979,33 @@
@@ -1970,6 +1988,33 @@
return;
}

Expand Down Expand Up @@ -74,7 +90,7 @@

/**************************************************************************
** Do a query. If query returned rows, free old rows.
@@ -2036,6 +2072,8 @@
@@ -2036,6 +2081,8 @@
old_pos= pos;
si_type= (enum enum_session_state_type)net_field_length(&pos);
switch(si_type) {
Expand All @@ -83,7 +99,7 @@
case SESSION_TRACK_SCHEMA:
case SESSION_TRACK_STATE_CHANGE:
case SESSION_TRACK_TRANSACTION_CHARACTERISTICS:
@@ -3474,18 +3512,27 @@
@@ -3474,18 +3521,27 @@
mariadb_get_charset_info(mysql, cs);
}

Expand Down Expand Up @@ -117,7 +133,7 @@
if (!mysql_real_query(mysql, buff, (unsigned long)strlen(buff)))
{
mysql->charset= cs;
@@ -3494,6 +3541,7 @@
@@ -3494,6 +3550,7 @@
}

error:
Expand Down