@@ -2254,7 +2254,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper, int ext)
2254
2254
}
2255
2255
/* end additional , gerrit thomson */
2256
2256
2257
- const zend_string * attribute = NULL ;
2257
+ zend_string * attribute = NULL ;
2258
2258
zval * attribute_values = NULL ;
2259
2259
unsigned int attribute_index = 0 ;
2260
2260
ZEND_HASH_FOREACH_STR_KEY_VAL (attributes_ht , attribute , attribute_values ) {
@@ -2276,7 +2276,8 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper, int ext)
2276
2276
2277
2277
ldap_mods [attribute_index ] = emalloc (sizeof (LDAPMod ));
2278
2278
ldap_mods [attribute_index ]-> mod_op = oper | LDAP_MOD_BVALUES ;
2279
- ldap_mods [attribute_index ]-> mod_type = estrndup (ZSTR_VAL (attribute ), ZSTR_LEN (attribute ));
2279
+ /* No need to duplicate the string as it is not consumed and the zend_string will not be released */
2280
+ ldap_mods [attribute_index ]-> mod_type = ZSTR_VAL (attribute );
2280
2281
ldap_mods [attribute_index ]-> mod_bvalues = NULL ;
2281
2282
2282
2283
ZVAL_DEREF (attribute_values );
@@ -2392,7 +2393,6 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper, int ext)
2392
2393
cleanup :
2393
2394
for (LDAPMod * * ptr = ldap_mods ; * ptr != NULL ; ptr ++ ) {
2394
2395
LDAPMod * mod = * ptr ;
2395
- efree (mod -> mod_type );
2396
2396
if (mod -> mod_bvalues != NULL ) {
2397
2397
for (struct berval * * bval_ptr = mod -> mod_bvalues ; * bval_ptr != NULL ; bval_ptr ++ ) {
2398
2398
struct berval * bval = * bval_ptr ;
0 commit comments