Author: uwendel
Date: 2008-04-14 19:11:28 +0200 (Mon, 14 Apr 2008)
New Revision: 1452
Modified:
trunk/php5/ext/pdo_mysqlnd/mysql_statement.c
Log:
THis makes more tests pass than fail - OR: fix leak
Modified: trunk/php5/ext/pdo_mysqlnd/mysql_statement.c
===================================================================
--- trunk/php5/ext/pdo_mysqlnd/mysql_statement.c 2008-04-14 15:51:08 UTC (rev 1451)
+++ trunk/php5/ext/pdo_mysqlnd/mysql_statement.c 2008-04-14 17:11:28 UTC (rev 1452)
@@ -63,6 +63,10 @@
}
#ifdef PDO_USE_MYSQLND
if (S->result_bind) {
+ int i;
+ for (i = 0; i < stmt->column_count; i++) {
+ zval_ptr_dtor(&S->result_bind[i].zv);
+ }
efree(S->result_bind);
}
#endif
@@ -117,6 +121,7 @@
if (S->stmt) {
/* (re)bind the parameters */
if (mysql_stmt_bind_param(S->stmt, S->params) || mysql_stmt_execute(S->stmt))
{
+ efree(S->params);
pdo_mysql_error_stmt(stmt);
PDO_DBG_RETURN(0);
}
@@ -134,14 +139,19 @@
mysqlnd_stmt_bind_result(S->stmt, S->result_bind);
} else {
/* TODO: not sure if this is needed */
+ unsigned int i;
+
if (S->result) {
+ // TODO: add a test to check if we really have zvals here...
mysql_free_result(S->result);
S->result = NULL;
}
/* TODO: we should use realloc() if possible */
if (S->stmt->field_count != stmt->column_count) {
- unsigned int i;
+ for (i = 0; i < stmt->column_count; i++) {
+ zval_ptr_dtor(&S->result_bind[i].zv);
+ }
efree(S->result_bind);
stmt->column_count = S->stmt->field_count;
S->result_bind = (MYSQLND_RESULT_BIND*)safe_emalloc(stmt->column_count,
sizeof(MYSQLND_RESULT_BIND), 0);
| Thread |
|---|
| • PHP mysqlnd svn commit: r1452 - trunk/php5/ext/pdo_mysqlnd | uwendel | 14 Apr |