summaryrefslogtreecommitdiff
path: root/ext/pdo/pdo_sql_parser.c
diff options
context:
space:
mode:
authorXinchen Hui <laruence@php.net>2014-05-08 15:19:43 +0800
committerXinchen Hui <laruence@php.net>2014-05-08 15:19:43 +0800
commit5f46c8fa31a8cfa0ad03b9aebd04243a09ac7be1 (patch)
treee313b94730dad0e615179c201cd031f5bba4f7b9 /ext/pdo/pdo_sql_parser.c
parentdfc940c5d95040ebc75c584e4104d760e181e2d1 (diff)
downloadphp-git-5f46c8fa31a8cfa0ad03b9aebd04243a09ac7be1.tar.gz
Fixed bugs in pdo_mysql
Diffstat (limited to 'ext/pdo/pdo_sql_parser.c')
-rw-r--r--ext/pdo/pdo_sql_parser.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/ext/pdo/pdo_sql_parser.c b/ext/pdo/pdo_sql_parser.c
index 4420fcf97c..50b2b5d6ec 100644
--- a/ext/pdo/pdo_sql_parser.c
+++ b/ext/pdo/pdo_sql_parser.c
@@ -434,6 +434,10 @@ struct placeholder {
struct placeholder *next;
};
+static void free_param_name(zval *el) {
+ efree(Z_PTR_P(el));
+}
+
PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len,
char **outquery, int *outquery_len TSRMLS_DC)
{
@@ -670,7 +674,7 @@ rewrite:
if (stmt->bound_param_map == NULL) {
ALLOC_HASHTABLE(stmt->bound_param_map);
- zend_hash_init(stmt->bound_param_map, 13, NULL, NULL, 0);
+ zend_hash_init(stmt->bound_param_map, 13, NULL, free_param_name, 0);
}
for (plc = placeholders; plc; plc = plc->next) {
@@ -711,12 +715,11 @@ rewrite:
if (stmt->bound_param_map == NULL) {
ALLOC_HASHTABLE(stmt->bound_param_map);
- zend_hash_init(stmt->bound_param_map, 13, NULL, NULL, 0);
+ zend_hash_init(stmt->bound_param_map, 13, NULL, free_param_name, 0);
}
for (plc = placeholders; plc; plc = plc->next) {
char *name;
-
name = estrndup(plc->pos, plc->len);
zend_hash_index_update_mem(stmt->bound_param_map, plc->bindno, name, plc->len + 1);
efree(name);