Permalink
Browse files

Merge branch 'PHP-5.4'

* PHP-5.4:
  - Fixed bug #55299 (multiple null pointer in win32/registry.c)
  • Loading branch information...
2 parents 910a469 + 1abcd81 commit 42faa077f9e763d29ee157a59e21007d7fd937aa @felipensp felipensp committed May 16, 2012
Showing with 10 additions and 2 deletions.
  1. +10 −2 win32/registry.c
View
@@ -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;

0 comments on commit 42faa07

Please sign in to comment.