mirror of
https://github.com/php/php-src.git
synced 2024-09-22 02:17:32 +00:00
Fix crash bug.
# how the f*** did this work in the first place!?
This commit is contained in:
parent
a86095fe07
commit
9bffcfb407
@ -227,34 +227,35 @@ void php_com_typelibrary_dtor(void *pDest)
|
|||||||
PHPAPI ITypeLib *php_com_load_typelib_via_cache(char *search_string,
|
PHPAPI ITypeLib *php_com_load_typelib_via_cache(char *search_string,
|
||||||
int codepage, int *cached TSRMLS_DC)
|
int codepage, int *cached TSRMLS_DC)
|
||||||
{
|
{
|
||||||
ITypeLib **TL;
|
ITypeLib **TLp;
|
||||||
|
ITypeLib *TL;
|
||||||
char *name_dup;
|
char *name_dup;
|
||||||
int l;
|
int l;
|
||||||
|
|
||||||
l = strlen(search_string);
|
l = strlen(search_string);
|
||||||
|
|
||||||
if (zend_ts_hash_find(&php_com_typelibraries, search_string, l+1,
|
if (zend_ts_hash_find(&php_com_typelibraries, search_string, l+1,
|
||||||
(void**)&TL) == SUCCESS) {
|
(void**)&TLp) == SUCCESS) {
|
||||||
*cached = 1;
|
*cached = 1;
|
||||||
/* add a reference for the caller */
|
/* add a reference for the caller */
|
||||||
ITypeLib_AddRef(*TL);
|
ITypeLib_AddRef(*TLp);
|
||||||
return *TL;
|
return *TLp;
|
||||||
}
|
}
|
||||||
|
|
||||||
*cached = 0;
|
*cached = 0;
|
||||||
name_dup = estrndup(search_string, l);
|
name_dup = estrndup(search_string, l);
|
||||||
*TL = php_com_load_typelib(name_dup, codepage TSRMLS_CC);
|
TL = php_com_load_typelib(name_dup, codepage TSRMLS_CC);
|
||||||
efree(name_dup);
|
efree(name_dup);
|
||||||
|
|
||||||
if (*TL) {
|
if (TL) {
|
||||||
if (SUCCESS == zend_ts_hash_update(&php_com_typelibraries,
|
if (SUCCESS == zend_ts_hash_update(&php_com_typelibraries,
|
||||||
search_string, l+1, (void*)*TL, sizeof(ITypeLib*), NULL)) {
|
search_string, l+1, (void*)TL, sizeof(ITypeLib*), NULL)) {
|
||||||
/* add a reference for the hash table */
|
/* add a reference for the hash table */
|
||||||
ITypeLib_AddRef(*TL);
|
ITypeLib_AddRef(TL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return *TL;
|
return TL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ITypeInfo *php_com_locate_typeinfo(char *typelibname, php_com_dotnet_object *obj, char *dispname, int sink TSRMLS_DC)
|
ITypeInfo *php_com_locate_typeinfo(char *typelibname, php_com_dotnet_object *obj, char *dispname, int sink TSRMLS_DC)
|
||||||
|
Loading…
Reference in New Issue
Block a user