diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index 4f7c74eaeba..62caef2e5fe 100755 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -306,10 +306,6 @@ static int really_register_bound_param(struct pdo_bound_param_data *param, pdo_s } } - if (is_param && !rewrite_name_to_position(stmt, param TSRMLS_CC)) { - return 0; - } - if (param->name) { if (is_param && param->name[0] != ':') { char *temp = emalloc(++param->namelen + 1); @@ -320,6 +316,14 @@ static int really_register_bound_param(struct pdo_bound_param_data *param, pdo_s param->name = estrndup(param->name, param->namelen); } } + + if (is_param && !rewrite_name_to_position(stmt, param TSRMLS_CC)) { + if (param->name) { + efree(param->name); + param->name = NULL; + } + return 0; + } /* tell the driver we just created a parameter */ if (stmt->methods->param_hook) {