Skip to content

Commit 52f1543

Browse files
author
Nirbhay Choubey
committed
Fix for a memory leak.
1 parent e996304 commit 52f1543

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

sql/wsrep_mysqld.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,6 +1199,7 @@ static int wsrep_TOI_begin(THD *thd, char *db_, char *table_,
11991199
uchar* buf(0);
12001200
size_t buf_len(0);
12011201
int buf_err;
1202+
int rc= 0;
12021203

12031204
WSREP_DEBUG("TO BEGIN: %lld, %d : %s", (long long)wsrep_thd_trx_seqno(thd),
12041205
thd->wsrep_exec_mode, thd->query() );
@@ -1238,7 +1239,6 @@ static int wsrep_TOI_begin(THD *thd, char *db_, char *table_,
12381239
{
12391240
thd->wsrep_exec_mode= TOTAL_ORDER;
12401241
wsrep_to_isolation++;
1241-
if (buf) my_free(buf);
12421242
wsrep_keys_free(&key_arr);
12431243
WSREP_DEBUG("TO BEGIN: %lld, %d",(long long)wsrep_thd_trx_seqno(thd),
12441244
thd->wsrep_exec_mode);
@@ -1250,18 +1250,18 @@ static int wsrep_TOI_begin(THD *thd, char *db_, char *table_,
12501250
ret, (thd->query()) ? thd->query() : "void");
12511251
my_error(ER_LOCK_DEADLOCK, MYF(0), "WSREP replication failed. Check "
12521252
"your wsrep connection state and retry the query.");
1253-
if (buf) my_free(buf);
12541253
wsrep_keys_free(&key_arr);
1255-
return -1;
1254+
rc= -1;
12561255
}
12571256
else {
12581257
/* non replicated DDL, affecting temporary tables only */
12591258
WSREP_DEBUG("TO isolation skipped for: %d, sql: %s."
12601259
"Only temporary tables affected.",
12611260
ret, (thd->query()) ? thd->query() : "void");
1262-
return 1;
1261+
rc= 1;
12631262
}
1264-
return 0;
1263+
if (buf) my_free(buf);
1264+
return rc;
12651265
}
12661266

12671267
static void wsrep_TOI_end(THD *thd) {

0 commit comments

Comments
 (0)