com php-src: - Fixed bug #55299 (multiple null pointer in win32/registry.c): win32/registry.c
| From: | Felipe Pena | Date: | Wed, 16 May 2012 11:40:12 +0000 |
| Subject: | com php-src: - Fixed bug #55299 (multiple null pointer in win32/registry.c): win32/registry.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-69090@lists.php.net to get a copy of this message | ||
Commit: 93c91c733cf2259263e4d8c0f3ccc254246d404d
Author: Felipe Pena <felipensp@gmail.com> Wed, 16 May 2012 08:40:12 -0300
Parents: 1af8b3f8836bd8fb997ebfead82cbf21d33ed916
Branches: PHP-5.3 PHP-5.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=93c91c733cf2259263e4d8c0f3ccc254246d404d
Log:
- Fixed bug #55299 (multiple null pointer in win32/registry.c)
Bugs:
https://bugs.php.net/55299
Changed paths:
M win32/registry.c
Diff:
diff --git a/win32/registry.c b/win32/registry.c
index 35b411f..45e842b 100644
--- a/win32/registry.c
+++ b/win32/registry.c
@@ -77,11 +77,16 @@ static int LoadDirectory(HashTable *directories, HKEY key, char *path, int path_
value_len = max_value+1;
if (RegEnumValue(key, i, name, &name_len, NULL, &type, value, &value_len) ==
ERROR_SUCCESS) {
if ((type == REG_SZ) || (type == REG_EXPAND_SZ)) {
+ ht = (HashTable*)malloc(sizeof(HashTable));
if (!ht) {
- ht = (HashTable*)malloc(sizeof(HashTable));
- zend_hash_init(ht, 0, NULL, ZVAL_INTERNAL_PTR_DTOR, 1);
+ return ret;
}
+ zend_hash_init(ht, 0, NULL, ZVAL_INTERNAL_PTR_DTOR, 1);
+
data = (zval*)malloc(sizeof(zval));
+ if (!data) {
+ return ret;
+ }
INIT_PZVAL(data);
Z_STRVAL_P(data) = zend_strndup(value, value_len-1);
Z_STRLEN_P(data) = value_len-1;
@@ -174,6 +179,9 @@ void UpdateIniFromRegistry(char *path TSRMLS_DC)
if (!PW32G(registry_directories)) {
PW32G(registry_directories) = (HashTable*)malloc(sizeof(HashTable));
+ if (!PW32G(registry_directories)) {
+ return;
+ }
zend_hash_init(PW32G(registry_directories), 0, NULL, delete_internal_hashtable, 1);
if (!OpenPhpRegistryKey("\\Per Directory Values", &PW32G(registry_key))) {
PW32G(registry_key) = NULL;