diff options
| author | Ilia Alshanetsky <iliaa@php.net> | 2005-04-28 00:25:25 +0000 |
|---|---|---|
| committer | Ilia Alshanetsky <iliaa@php.net> | 2005-04-28 00:25:25 +0000 |
| commit | 3be50385abd48d8bd643565199c60aebd2bacc22 (patch) | |
| tree | 2fffa5520619bbb19e94f9506d1dd583a6ae856f | |
| parent | 56b3cac3651b33ed09ea60078eb52a74ec0114e9 (diff) | |
| download | php-git-3be50385abd48d8bd643565199c60aebd2bacc22.tar.gz | |
Allocation checks around persistent allocs that can fail.
| -rwxr-xr-x | ext/pdo/pdo_dbh.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index 787db5db86..29b0a716cd 100755 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -323,7 +323,9 @@ static PHP_FUNCTION(dbh_constructor) } 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 @@ int pdo_hash_methods(pdo_dbh_t *dbh, int kind TSRMLS_DC) 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) { |
