mirror of
https://github.com/php/php-src.git
synced 2025-08-18 15:08:55 +02:00
fixed malloc() / emalloc() bug
This commit is contained in:
parent
499334e498
commit
85bb9e77e4
2 changed files with 42 additions and 10 deletions
|
@ -1239,7 +1239,7 @@ PHPAPI pval php_COM_get_property_handler(zend_property_reference *property_refer
|
||||||
{
|
{
|
||||||
efree(obj_prop);
|
efree(obj_prop);
|
||||||
obj_prop = NULL;
|
obj_prop = NULL;
|
||||||
php_variant_to_pval(var_result, &return_value, TRUE, codepage);
|
php_variant_to_pval(var_result, &return_value, FALSE, codepage);
|
||||||
}
|
}
|
||||||
|
|
||||||
pval_destructor(&overloaded_property->element);
|
pval_destructor(&overloaded_property->element);
|
||||||
|
@ -1633,6 +1633,7 @@ static int php_COM_load_typelib(ITypeLib *TypeLib, int mode)
|
||||||
BSTR bstr_ids;
|
BSTR bstr_ids;
|
||||||
char *ids;
|
char *ids;
|
||||||
zend_constant c;
|
zend_constant c;
|
||||||
|
zval exists, results;
|
||||||
|
|
||||||
TypeInfo->lpVtbl->GetNames(TypeInfo, pVarDesc->memid, &bstr_ids, 1, &NameCount);
|
TypeInfo->lpVtbl->GetNames(TypeInfo, pVarDesc->memid, &bstr_ids, 1, &NameCount);
|
||||||
if(NameCount!=1)
|
if(NameCount!=1)
|
||||||
|
@ -1640,15 +1641,30 @@ static int php_COM_load_typelib(ITypeLib *TypeLib, int mode)
|
||||||
j++;
|
j++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
LocalFree(bstr_ids);
|
|
||||||
ids = php_OLECHAR_to_char(bstr_ids, NULL, 1, codepage);
|
ids = php_OLECHAR_to_char(bstr_ids, NULL, 1, codepage);
|
||||||
|
SysFreeString(bstr_ids);
|
||||||
c.name_len = strlen(ids)+1;
|
c.name_len = strlen(ids)+1;
|
||||||
c.name = ids;
|
c.name = ids;
|
||||||
php_variant_to_pval(pVarDesc->lpvarValue, &c.value, 1, codepage);
|
if (zend_get_constant(c.name, c.name_len-1, &exists))
|
||||||
|
{
|
||||||
|
/* Oops, it already exists. No problem if it is defined as the same value */
|
||||||
|
/* Check to see if they are the same */
|
||||||
|
if (!compare_function(&results, &c.value, &exists))
|
||||||
|
{
|
||||||
|
php_error(E_WARNING,"Type library value %s is already defined and has a different value", c.name);
|
||||||
|
}
|
||||||
|
free(ids);
|
||||||
|
j++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
php_variant_to_pval(pVarDesc->lpvarValue, &c.value, FALSE, codepage);
|
||||||
c.flags = mode;
|
c.flags = mode;
|
||||||
|
|
||||||
zend_register_constant(&c ELS_CC);
|
/* Before registering the contsnt, let's see if we can find it */
|
||||||
/*printf("%s -> %ld\n", ids, pVarDesc->lpvarValue->lVal);*/
|
{
|
||||||
|
zend_register_constant(&c ELS_CC);
|
||||||
|
}
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
TypeInfo->lpVtbl->Release(TypeInfo);
|
TypeInfo->lpVtbl->Release(TypeInfo);
|
||||||
|
|
|
@ -1239,7 +1239,7 @@ PHPAPI pval php_COM_get_property_handler(zend_property_reference *property_refer
|
||||||
{
|
{
|
||||||
efree(obj_prop);
|
efree(obj_prop);
|
||||||
obj_prop = NULL;
|
obj_prop = NULL;
|
||||||
php_variant_to_pval(var_result, &return_value, TRUE, codepage);
|
php_variant_to_pval(var_result, &return_value, FALSE, codepage);
|
||||||
}
|
}
|
||||||
|
|
||||||
pval_destructor(&overloaded_property->element);
|
pval_destructor(&overloaded_property->element);
|
||||||
|
@ -1633,6 +1633,7 @@ static int php_COM_load_typelib(ITypeLib *TypeLib, int mode)
|
||||||
BSTR bstr_ids;
|
BSTR bstr_ids;
|
||||||
char *ids;
|
char *ids;
|
||||||
zend_constant c;
|
zend_constant c;
|
||||||
|
zval exists, results;
|
||||||
|
|
||||||
TypeInfo->lpVtbl->GetNames(TypeInfo, pVarDesc->memid, &bstr_ids, 1, &NameCount);
|
TypeInfo->lpVtbl->GetNames(TypeInfo, pVarDesc->memid, &bstr_ids, 1, &NameCount);
|
||||||
if(NameCount!=1)
|
if(NameCount!=1)
|
||||||
|
@ -1640,15 +1641,30 @@ static int php_COM_load_typelib(ITypeLib *TypeLib, int mode)
|
||||||
j++;
|
j++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
LocalFree(bstr_ids);
|
|
||||||
ids = php_OLECHAR_to_char(bstr_ids, NULL, 1, codepage);
|
ids = php_OLECHAR_to_char(bstr_ids, NULL, 1, codepage);
|
||||||
|
SysFreeString(bstr_ids);
|
||||||
c.name_len = strlen(ids)+1;
|
c.name_len = strlen(ids)+1;
|
||||||
c.name = ids;
|
c.name = ids;
|
||||||
php_variant_to_pval(pVarDesc->lpvarValue, &c.value, 1, codepage);
|
if (zend_get_constant(c.name, c.name_len-1, &exists))
|
||||||
|
{
|
||||||
|
/* Oops, it already exists. No problem if it is defined as the same value */
|
||||||
|
/* Check to see if they are the same */
|
||||||
|
if (!compare_function(&results, &c.value, &exists))
|
||||||
|
{
|
||||||
|
php_error(E_WARNING,"Type library value %s is already defined and has a different value", c.name);
|
||||||
|
}
|
||||||
|
free(ids);
|
||||||
|
j++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
php_variant_to_pval(pVarDesc->lpvarValue, &c.value, FALSE, codepage);
|
||||||
c.flags = mode;
|
c.flags = mode;
|
||||||
|
|
||||||
zend_register_constant(&c ELS_CC);
|
/* Before registering the contsnt, let's see if we can find it */
|
||||||
/*printf("%s -> %ld\n", ids, pVarDesc->lpvarValue->lVal);*/
|
{
|
||||||
|
zend_register_constant(&c ELS_CC);
|
||||||
|
}
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
TypeInfo->lpVtbl->Release(TypeInfo);
|
TypeInfo->lpVtbl->Release(TypeInfo);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue