Skip to content

Commit

Permalink
Merge pull request #3335 from sysown/v2.1.1-3334
Browse files Browse the repository at this point in the history
Closes #3334: Fix crash and memory errors reported by valgrind for v2.1.1
  • Loading branch information
renecannao authored Mar 11, 2021
2 parents 7a8c984 + b11bc4b commit 6de72f3
Show file tree
Hide file tree
Showing 2 changed files with 238 additions and 123 deletions.
7 changes: 6 additions & 1 deletion lib/mysql_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1620,7 +1620,9 @@ void MySQL_Connection::process_rows_in_ASYNC_STMT_EXECUTE_STORE_RESULT_CONT(unsi
myds->bytes_info.bytes_recv += br;
bytes_info.bytes_recv += br;
processed_bytes+=br; // issue #527 : this variable will store the amount of bytes processed during this event
if (irs < query.stmt->result.rows - 2) {

// we stop when we 'ir->next' will be pointing to the last row
if (irs <= query.stmt->result.rows - 2) {
ir = ir->next;
}
}
Expand All @@ -1646,6 +1648,9 @@ void MySQL_Connection::process_rows_in_ASYNC_STMT_EXECUTE_STORE_RESULT_CONT(unsi
// update 'stmt->result.data' to the new allocated memory and copy the backed last row
query.stmt->result.data = current;
memcpy((char *)current->data, (char *)lcopy->data, lcopy->length);
// update the 'current->length' with the length of the copied row
current->length = lcopy->length;

// we free the copy
free(lcopy);
// change the rows count to 1
Expand Down
Loading

0 comments on commit 6de72f3

Please sign in to comment.