Fixed #3: Runtime segmentation fault with the latest version as of 2015/04/22
2 issues: 1. --mysql-dry-run was enabled by default 2. mysql_drv_query() attempted to use uninitialized memory in case of --mysql-dry-run.
This commit is contained in:
@ -80,7 +80,7 @@ static sb_arg_t mysql_drv_args[] =
|
||||
{"mysql-ignore-errors", "list of errors to ignore, or \"all\"",
|
||||
SB_ARG_TYPE_LIST, "1213,1020,1205"},
|
||||
{"mysql-dry-run", "Dry run, pretent that all MySQL client API calls are successful without executing them",
|
||||
SB_ARG_TYPE_FLAG, NULL},
|
||||
SB_ARG_TYPE_FLAG, "off"},
|
||||
|
||||
{NULL, NULL, SB_ARG_TYPE_NULL, NULL}
|
||||
};
|
||||
@ -795,8 +795,8 @@ int mysql_drv_execute(db_stmt_t *stmt, db_result_set_t *rs)
|
||||
int mysql_drv_query(db_conn_t *sb_conn, const char *query,
|
||||
db_result_set_t *rs)
|
||||
{
|
||||
db_mysql_conn_t *db_mysql_con = (db_mysql_conn_t *)sb_conn->ptr;
|
||||
MYSQL *con = db_mysql_con->mysql;
|
||||
db_mysql_conn_t *db_mysql_con;
|
||||
MYSQL *con;
|
||||
unsigned int rc;
|
||||
|
||||
(void)rs; /* unused */
|
||||
@ -804,6 +804,9 @@ int mysql_drv_query(db_conn_t *sb_conn, const char *query,
|
||||
if (args.dry_run)
|
||||
return 0;
|
||||
|
||||
db_mysql_con = (db_mysql_conn_t *)sb_conn->ptr;
|
||||
con = db_mysql_con->mysql;
|
||||
|
||||
rc = (unsigned int)mysql_real_query(con, query, strlen(query));
|
||||
DEBUG("mysql_real_query(%p, \"%s\", %u) = %u", con, query, strlen(query), rc);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user