diff options
Diffstat (limited to 'ext/mysqlnd/mysqlnd_connection.c')
-rw-r--r-- | ext/mysqlnd/mysqlnd_connection.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/ext/mysqlnd/mysqlnd_connection.c b/ext/mysqlnd/mysqlnd_connection.c index e836ef1238..9bc3c851e4 100644 --- a/ext/mysqlnd/mysqlnd_connection.c +++ b/ext/mysqlnd/mysqlnd_connection.c @@ -102,7 +102,7 @@ MYSQLND_METHOD(mysqlnd_error_info, reset)(MYSQLND_ERROR_INFO * const info) info->error_no = 0; info->error[0] = '\0'; - memset(info->sqlstate, 0, sizeof(info->sqlstate)); + memset(&info->sqlstate, 0, sizeof(info->sqlstate)); if (info->error_list) { zend_llist_clean(info->error_list); } @@ -409,11 +409,8 @@ MYSQLND_METHOD(mysqlnd_conn_data, restart_psession)(MYSQLND_CONN_DATA * conn) { DBG_ENTER("mysqlnd_conn_data::restart_psession"); MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_CONNECT_REUSED); - /* Free here what should not be seen by the next script */ - if (conn->last_message.s) { - mnd_pefree(conn->last_message.s, conn->persistent); - conn->last_message.s = NULL; - } + conn->current_result = NULL; + conn->last_message.s = NULL; DBG_RETURN(PASS); } /* }}} */ @@ -424,6 +421,16 @@ static enum_func_status MYSQLND_METHOD(mysqlnd_conn_data, end_psession)(MYSQLND_CONN_DATA * conn) { DBG_ENTER("mysqlnd_conn_data::end_psession"); + /* Free here what should not be seen by the next script */ + if (conn->current_result) { + conn->current_result->m.free_result(conn->current_result, TRUE); + conn->current_result = NULL; + } + if (conn->last_message.s) { + mnd_efree(conn->last_message.s); + conn->last_message.s = NULL; + } + conn->error_info = &conn->error_info_impl; DBG_RETURN(PASS); } /* }}} */ @@ -1859,8 +1866,12 @@ MYSQLND_METHOD(mysqlnd_conn_data, set_client_option_2d)(MYSQLND_CONN_DATA * cons DBG_INF_FMT("Adding [%s][%s]", key, value); { zval attrz; + zend_string *str = zend_string_init(key, strlen(key), 1); + GC_MAKE_PERSISTENT_LOCAL(str); ZVAL_NEW_STR(&attrz, zend_string_init(value, strlen(value), conn->persistent)); - zend_hash_str_update(conn->options->connect_attr, key, strlen(key), &attrz); + GC_MAKE_PERSISTENT_LOCAL(Z_COUNTED(attrz)); + zend_hash_update(conn->options->connect_attr, str, &attrz); + zend_string_release(str); } break; default: @@ -2321,7 +2332,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, stmt_init)(MYSQLND_CONN_DATA * const conn) { MYSQLND_STMT * ret; DBG_ENTER("mysqlnd_conn_data::stmt_init"); - ret = conn->object_factory.get_prepared_statement(conn, conn->persistent); + ret = conn->object_factory.get_prepared_statement(conn); DBG_RETURN(ret); } /* }}} */ |