Skip to content

Commit de82d8a

Browse files
author
Michal Jankowski
committed
Bug#36600203: There is a memory leak defect on line 3960 of the mysql.cc file
Problem: There is a return statement after the momory is allocated and before the memory is freed. The return may be reached before the memory is needed. Fix: Move the memory allocation after the return statement. This is a backport from mysql-trunk Change-Id: I14648efaebf38b5b81c08290e169ad44c72ac17a
1 parent 550fa67 commit de82d8a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

client/mysql.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3592,13 +3592,13 @@ static void print_table_data(MYSQL_RES *result) {
35923592
bool *num_flag;
35933593
size_t sz;
35943594

3595-
sz = sizeof(bool) * mysql_num_fields(result);
3596-
num_flag = (bool *)my_safe_alloca(sz, MAX_ALLOCA_SIZE);
35973595
if (column_types_flag) {
35983596
print_field_types(result);
35993597
if (!mysql_num_rows(result)) return;
36003598
mysql_field_seek(result, 0);
36013599
}
3600+
sz = sizeof(bool) * mysql_num_fields(result);
3601+
num_flag = (bool *)my_safe_alloca(sz, MAX_ALLOCA_SIZE);
36023602
separator.copy("+", 1, charset_info);
36033603
while ((field = mysql_fetch_field(result))) {
36043604
size_t length = column_names ? field->name_length : 0;

0 commit comments

Comments
 (0)