andrey          Fri Dec 23 22:22:42 2005 EDT

  Modified files:              (Branch: PHP_5_1)
    /php-src/ext/mysqli mysqli_api.c 
    /php-src    NEWS 
  Log:
  fix small memory leak which emerged two days ago
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/mysqli/mysqli_api.c?r1=1.118.2.12&r2=1.118.2.13&diff_format=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.118.2.12 
php-src/ext/mysqli/mysqli_api.c:1.118.2.13
--- php-src/ext/mysqli/mysqli_api.c:1.118.2.12  Fri Dec 23 18:23:43 2005
+++ php-src/ext/mysqli/mysqli_api.c     Fri Dec 23 22:22:41 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter <[EMAIL PROTECTED]>                                |
   +----------------------------------------------------------------------+
 
-  $Id: mysqli_api.c,v 1.118.2.12 2005/12/23 18:23:43 sesser Exp $ 
+  $Id: mysqli_api.c,v 1.118.2.13 2005/12/23 22:22:41 andrey Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -285,7 +285,7 @@
                                bind[ofs].buffer = 0;
                                bind[ofs].is_null = &stmt->result.is_null[ofs];
                                bind[ofs].buffer_length = 0;
-                       break;
+                               break;
 
                        case MYSQL_TYPE_SHORT:
                        case MYSQL_TYPE_TINY:
@@ -649,7 +649,8 @@
        if (!ret) {
 #endif
                for (i = 0; i < stmt->result.var_cnt; i++) {
-                       if (stmt->result.vars[i]->type == IS_STRING && 
stmt->result.vars[i]->value.str.len) {
+                       /* Even if the string is of length zero there is one 
byte alloced so efree() in all cases */
+                       if (Z_TYPE_P(stmt->result.vars[i]) == IS_STRING) {
                        efree(stmt->result.vars[i]->value.str.val);
                        }
                        if (!stmt->result.is_null[i]) {
@@ -711,7 +712,7 @@
                                                break;  
                                }
                        } else {
-                               stmt->result.vars[i]->type = IS_NULL;
+                               ZVAL_NULL(stmt->result.vars[i]);
                        }
                }
        } else {
http://cvs.php.net/viewcvs.cgi/php-src/NEWS?r1=1.2027.2.320&r2=1.2027.2.321&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.320 php-src/NEWS:1.2027.2.321
--- php-src/NEWS:1.2027.2.320   Fri Dec 23 20:40:52 2005
+++ php-src/NEWS        Fri Dec 23 22:22:42 2005
@@ -43,6 +43,8 @@
 - Fixed many bugs in OCI8. (Tony)
 - Fixed crash and leak in mysqli when using 4.1.x client libraries and
   connecting to 5.x server. (Andrey)
+- Fixed small leak in mysqli_stmt_fetch() when bound variable was empty
+  string. (Andrey)
 - Fixed bug #35760 (sybase_ct doesn't compile on Solaris using old gcc). (Tony)
 - Fixed bug #35740 (memory leak when including a directory). (Tony)
 - Fixed bug #35730 (ext/mssql + freetds: Use correct character encoding

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to