iliaa Wed Apr 27 20:25:25 2005 EDT Modified files: /php-src/ext/pdo pdo_dbh.c Log: Allocation checks around persistent allocs that can fail. http://cvs.php.net/diff.php/php-src/ext/pdo/pdo_dbh.c?r1=1.70&r2=1.71&ty=u Index: php-src/ext/pdo/pdo_dbh.c diff -u php-src/ext/pdo/pdo_dbh.c:1.70 php-src/ext/pdo/pdo_dbh.c:1.71 --- php-src/ext/pdo/pdo_dbh.c:1.70 Sun Mar 20 19:29:06 2005 +++ php-src/ext/pdo/pdo_dbh.c Wed Apr 27 20:25:25 2005 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pdo_dbh.c,v 1.70 2005/03/21 00:29:06 helly Exp $ */ +/* $Id: pdo_dbh.c,v 1.71 2005/04/28 00:25:25 iliaa Exp $ */ /* The PDO Database Handle Class */ @@ -323,7 +323,9 @@ } pdbh->is_persistent = 1; - pdbh->persistent_id = pemalloc(plen + 1, 1); + if (!(pdbh->persistent_id = pemalloc(plen + 1, 1))) { + php_error_docref(NULL TSRMLS_CC, E_ERROR, "out of memory while allocating PDO handle"); + } memcpy((char *)pdbh->persistent_id, hashkey, plen+1); pdbh->persistent_id_len = plen+1; pdbh->refcount = 1; @@ -973,7 +975,9 @@ return 0; } - dbh->cls_methods[kind] = pemalloc(sizeof(HashTable), dbh->is_persistent); + if (!(dbh->cls_methods[kind] = pemalloc(sizeof(HashTable), dbh->is_persistent))) { + php_error_docref(NULL TSRMLS_CC, E_ERROR, "out of memory while allocating PDO methods."); + } zend_hash_init_ex(dbh->cls_methods[kind], 8, NULL, NULL, dbh->is_persistent, 0); while (funcs->fname) {
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php