[MDEV-12660] inconsistent mysql_stmt_close Created: 2017-05-02 Updated: 2017-05-16 Resolved: 2017-05-16 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Prepared Statements |
| Affects Version/s: | 5.5, 10.0, 10.1, 10.2 |
| Fix Version/s: | 10.1.24, 10.0.31 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Sergei Golubchik | Assignee: | Sergei Golubchik |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
mysql_stmt_close() is inconsistent in 10.0 and 10.1. It returns 1 on an error and 0 on success. But the stmt handle is freed for some errors and not freed for others. The caller has no way of knowing whether the handle was freed. It should either free or keep the handle for all errors.
|
| Comments |
| Comment by Sergei Golubchik [ 2017-05-02 ] |
|
That example from the MySQL manual uses the stmt handle to retrieve the error message after mysql_stmt_close() failed. I'd suggest to free the stmt handle unconditionally. The caller can retrieve the error message from the mysql handle. |
| Comment by Sergei Golubchik [ 2017-05-13 ] |
|
In fact, stmt was freed unconditionally, this confusing return that supposedly could've left stmt allocated, it was a dead code, it could never have happened. |