php7_ext_wrapper.h: fix memory leak in php 7
parent
1eab718d4f
commit
60cd0565e5
3
HISTORY
3
HISTORY
|
|
@ -1,6 +1,7 @@
|
||||||
|
|
||||||
Version 1.30 2016-07-25
|
Version 1.30 2016-08-01
|
||||||
* modify php-fastcommon/test.php
|
* modify php-fastcommon/test.php
|
||||||
|
* php7_ext_wrapper.h: fix memory leak in php 7
|
||||||
|
|
||||||
Version 1.29 2016-06-17
|
Version 1.29 2016-06-17
|
||||||
* ini_file_reader support #@if
|
* ini_file_reader support #@if
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ static inline int zend_get_configuration_directive_wrapper(char *name, int len,
|
||||||
return zend_get_configuration_directive(name, len, *value);
|
return zend_get_configuration_directive(name, len, *value);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else //php 7
|
||||||
|
|
||||||
typedef size_t zend_size_t;
|
typedef size_t zend_size_t;
|
||||||
#define ZEND_RETURN_STRING(s, dup) RETURN_STRING(s)
|
#define ZEND_RETURN_STRING(s, dup) RETURN_STRING(s)
|
||||||
|
|
@ -187,9 +187,14 @@ static inline int zend_hash_index_find_wrapper(HashTable *ht, int index,
|
||||||
static inline int zend_hash_update_wrapper(HashTable *ht, char *k, int len,
|
static inline int zend_hash_update_wrapper(HashTable *ht, char *k, int len,
|
||||||
zval **val, int size, void *ptr)
|
zval **val, int size, void *ptr)
|
||||||
{
|
{
|
||||||
zval key;
|
zend_string *key;
|
||||||
ZVAL_STRINGL(&key, k, len - 1);
|
bool use_heap;
|
||||||
return zend_hash_update(ht, Z_STR(key), *val) ? SUCCESS : FAILURE;
|
int result;
|
||||||
|
|
||||||
|
ZSTR_ALLOCA_INIT(key, k, len - 1, use_heap);
|
||||||
|
result = zend_hash_update(ht, key, *val) ? SUCCESS : FAILURE;
|
||||||
|
ZSTR_ALLOCA_FREE(key, use_heap);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int zend_call_user_function_wrapper(HashTable *function_table,
|
static inline int zend_call_user_function_wrapper(HashTable *function_table,
|
||||||
|
|
@ -215,9 +220,12 @@ static inline int zend_call_user_function_wrapper(HashTable *function_table,
|
||||||
static inline int zend_get_configuration_directive_wrapper(char *name, int len,
|
static inline int zend_get_configuration_directive_wrapper(char *name, int len,
|
||||||
zval **value)
|
zval **value)
|
||||||
{
|
{
|
||||||
zval key;
|
zend_string *key;
|
||||||
ZVAL_STRINGL(&key, name, len - 1);
|
bool use_heap;
|
||||||
*value = zend_get_configuration_directive(Z_STR(key));
|
|
||||||
|
ZSTR_ALLOCA_INIT(key, name, len - 1, use_heap);
|
||||||
|
*value = zend_get_configuration_directive(key);
|
||||||
|
ZSTR_ALLOCA_FREE(key, use_heap);
|
||||||
return (*value != NULL ? SUCCESS : FAILURE);
|
return (*value != NULL ? SUCCESS : FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue