iliaa           Wed Nov 29 15:45:59 2006 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/ext/pgsql  pgsql.c 
    /php-src/ext/pdo_pgsql      pgsql_driver.c 
    /php-src    NEWS 
  Log:
  Fixed bug #39663 (Memory leak in pg_get_notify() and a possible memory
  corruption on Windows in pgsql and pdo_pgsql extensions).
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pgsql/pgsql.c?r1=1.331.2.13.2.10&r2=1.331.2.13.2.11&diff_format=u
Index: php-src/ext/pgsql/pgsql.c
diff -u php-src/ext/pgsql/pgsql.c:1.331.2.13.2.10 
php-src/ext/pgsql/pgsql.c:1.331.2.13.2.11
--- php-src/ext/pgsql/pgsql.c:1.331.2.13.2.10   Mon Nov 13 22:10:36 2006
+++ php-src/ext/pgsql/pgsql.c   Wed Nov 29 15:45:58 2006
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
  */
  
-/* $Id: pgsql.c,v 1.331.2.13.2.10 2006/11/13 22:10:36 iliaa Exp $ */
+/* $Id: pgsql.c,v 1.331.2.13.2.11 2006/11/29 15:45:58 iliaa Exp $ */
 
 #include <stdlib.h>
 
@@ -3358,7 +3358,7 @@
                                                        break;
                                                default:
                                                        
add_next_index_string(return_value, csv, 1);
-                                                       free(csv);
+                                                       PQfreemem(csv);
                                                        break;
                                        }
                                }
@@ -3610,7 +3610,7 @@
                to = (char *)PQescapeBytea((unsigned char*)from, from_len, 
&to_len);
 
        RETVAL_STRINGL(to, to_len-1, 1); /* to_len includes addtional '\0' */
-       free(to);
+       PQfreemem(to);
 }
 /* }}} */
 
@@ -3735,7 +3735,7 @@
 #if HAVE_PQUNESCAPEBYTEA
        tmp = (char *)PQunescapeBytea((unsigned char*)from, &to_len);
        to = estrndup(tmp, to_len);
-       free(tmp);
+       PQfreemem(tmp);
 #else
        to = (char *)php_pgsql_unescape_bytea((unsigned char*)from, &to_len);
 #endif
@@ -4348,6 +4348,7 @@
                add_assoc_string(return_value, "message", 
pgsql_notify->relname, 1);
                add_assoc_long(return_value, "pid", pgsql_notify->be_pid);
        }
+       PQfreemem(pgsql_notify);
 }
 /* }}} */
 
@@ -5153,7 +5154,7 @@
                                                        Z_STRLEN_P(new_val) = 
to_len-1; /* PQescapeBytea's to_len includes additional '\0' */
                                                        Z_STRVAL_P(new_val) = 
emalloc(to_len);
                                                        
memcpy(Z_STRVAL_P(new_val), tmp, to_len);
-                                                       free(tmp);
+                                                       PQfreemem(tmp);
                                                        
php_pgsql_add_quotes(new_val, 1 TSRMLS_CC);
                                                                
                                                }
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_pgsql/pgsql_driver.c?r1=1.53.2.14.2.4&r2=1.53.2.14.2.5&diff_format=u
Index: php-src/ext/pdo_pgsql/pgsql_driver.c
diff -u php-src/ext/pdo_pgsql/pgsql_driver.c:1.53.2.14.2.4 
php-src/ext/pdo_pgsql/pgsql_driver.c:1.53.2.14.2.5
--- php-src/ext/pdo_pgsql/pgsql_driver.c:1.53.2.14.2.4  Fri Oct  6 22:34:16 2006
+++ php-src/ext/pdo_pgsql/pgsql_driver.c        Wed Nov 29 15:45:58 2006
@@ -18,7 +18,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: pgsql_driver.c,v 1.53.2.14.2.4 2006/10/06 22:34:16 iliaa Exp $ */
+/* $Id: pgsql_driver.c,v 1.53.2.14.2.5 2006/11/29 15:45:58 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -325,7 +325,7 @@
                        (*quoted)[0] = '\'';
                        (*quoted)[*quotedlen-1] = '\'';
                        (*quoted)[*quotedlen] = '\0';
-                       free(escaped);
+                       PQfreemem(escaped);
                        break;
                default:
                        *quoted = safe_emalloc(2, unquotedlen, 3);
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.382&r2=1.2027.2.547.2.383&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.382 php-src/NEWS:1.2027.2.547.2.383
--- php-src/NEWS:1.2027.2.547.2.382     Wed Nov 29 11:12:59 2006
+++ php-src/NEWS        Wed Nov 29 15:45:59 2006
@@ -45,6 +45,9 @@
 - Added optimization for imageline with horizontal and vertial lines (Pierre)
 - Fixed bug #39673 (file_get_contents causes bus error on certain offsets). 
   (Tony)
+- Fixed bug #39663 (Memory leak in pg_get_notify() and a possible memory
+  corruption on Windows in pgsql and pdo_pgsql extensions). (Ilia, matteo at
+  beccati dot com)
 - Fixed bug #39662 (Segfault when calling asXML() of a cloned 
SimpleXMLElement).
   (Rob, Tony)
 - Fixed bug #39656 (crash when calling fetch() on a PDO statment object

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

Reply via email to