Details

    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.

      • MariaDB 5.5, MariaDB 10.2 (with C/C), and MySQL (5.5–5.7) — they all free the handle unconditionally.
      • MySQL manual shows an example of using the handle after mysql_stmt_close() returned an error, which implies that the handle should not be freed.

      Attachments

        Issue Links

          Activity

            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.

            serg Sergei Golubchik added a comment - 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.

            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.

            serg Sergei Golubchik added a comment - 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.

            People

              serg Sergei Golubchik
              serg Sergei Golubchik
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.