[CONC-118] Options get lost and Memory-leak when reconnecting Created: 2014-12-30 Updated: 2015-01-15 Resolved: 2015-01-10 |
|
| Status: | Closed |
| Project: | MariaDB Connector/C |
| Component/s: | None |
| Affects Version/s: | 2.0.0 |
| Fix Version/s: | 2.1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Tianhong | Assignee: | Georg Richter |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Linux 32/64 bit |
||
| Attachments: |
|
| Description |
|
Hi Georg, thanks for fixing the bug 1. Original options from client would get lost if reconnecting fails, because of the bzero() before function "mysql_real_connect()" 2. The free_me flag in original mysql object is set to 0, which would lead to memory leak. You should store the old value and set it back after cloning from tmp_mysql object. I wrote the patch with some comment. More details and descriptions can be found in uploaded file. |
| Comments |
| Comment by Georg Richter [ 2015-01-10 ] |
|
fixed in rev. 192 |
| Comment by Tianhong [ 2015-01-12 ] |
|
Hey Georg, thanks for the support. I read the new code and thought that the first issue is still there: "Original options from client would get lost if reconnecting fails, because of the bzero() before function "mysql_real_connect()" It locates on line 2025 in file libmariadb.c from rev.192 If I have understood the code correctly, the "bzero" function which resets the options of mysql object is unnecessary here. Because if the reconnecting fails and enters into the if block below, the original option from mysql object would get lost ( yes it is not freed, but the option field in mysql object is 0 ). --------------------------------------------------------------------------------------------------------- |
| Comment by Georg Richter [ 2015-01-14 ] |
|
Hi Tanhong, it's correct bzeroing options should be removed. Thanks for your help! |
| Comment by Tianhong [ 2015-01-15 ] |
|
My pleasure! |