tony2001 Wed Mar 7 09:02:18 2007 UTC
Modified files:
/php-src/ext/pdo pdo_stmt.c
Log:
fix #40727 (segfault in PDO when failed to bind parameters)
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo/pdo_stmt.c?r1=1.172&r2=1.173&diff_format=u
Index: php-src/ext/pdo/pdo_stmt.c
diff -u php-src/ext/pdo/pdo_stmt.c:1.172 php-src/ext/pdo/pdo_stmt.c:1.173
--- php-src/ext/pdo/pdo_stmt.c:1.172 Mon Jan 1 09:29:27 2007
+++ php-src/ext/pdo/pdo_stmt.c Wed Mar 7 09:02:18 2007
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pdo_stmt.c,v 1.172 2007/01/01 09:29:27 sebastian Exp $ */
+/* $Id: pdo_stmt.c,v 1.173 2007/03/07 09:02:18 tony2001 Exp $ */
/* The PDO Statement Handle Class */
@@ -251,7 +251,10 @@
efree(param->name);
}
- zval_ptr_dtor(&(param->parameter));
+ if (param->parameter) {
+ zval_ptr_dtor(&(param->parameter));
+ param->parameter = NULL;
+ }
if (param->driver_params) {
zval_ptr_dtor(&(param->driver_params));
}
@@ -1556,7 +1559,10 @@
ZVAL_ADDREF(param.parameter);
if (!really_register_bound_param(¶m, stmt, is_param TSRMLS_CC)) {
- zval_ptr_dtor(&(param.parameter));
+ if (param.parameter) {
+ zval_ptr_dtor(&(param.parameter));
+ param.parameter = NULL;
+ }
return 0;
}
return 1;
@@ -1589,7 +1595,10 @@
ZVAL_ADDREF(param.parameter);
if (!really_register_bound_param(¶m, stmt, TRUE TSRMLS_CC)) {
- zval_ptr_dtor(&(param.parameter));
+ if (param.parameter) {
+ zval_ptr_dtor(&(param.parameter));
+ param.parameter = NULL;
+ }
RETURN_FALSE;
}
RETURN_TRUE;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php