@@ -997,7 +997,7 @@ PHP_FUNCTION(ldap_first_attribute)
997
997
ZEND_REGISTER_RESOURCE (return_value , ber , le_ber_entry );
998
998
999
999
RETVAL_STRING (attribute ,1 );
1000
- #ifdef WINDOWS
1000
+ #if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP || WINDOWS
1001
1001
ldap_memfree (attribute );
1002
1002
#endif
1003
1003
}
@@ -1028,7 +1028,7 @@ PHP_FUNCTION(ldap_next_attribute)
1028
1028
ZEND_REGISTER_RESOURCE (return_value , ber , le_ber_entry );
1029
1029
1030
1030
RETVAL_STRING (attribute ,1 );
1031
- #ifdef WINDOWS
1031
+ #if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP || WINDOWS
1032
1032
ldap_memfree (attribute );
1033
1033
#endif
1034
1034
}
@@ -1075,8 +1075,15 @@ PHP_FUNCTION(ldap_get_attributes)
1075
1075
add_index_string (return_value , num_attrib , attribute , 1 );
1076
1076
1077
1077
num_attrib ++ ;
1078
+ #if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP || WINDOWS
1079
+ ldap_memfree (attribute );
1080
+ #endif
1078
1081
attribute = ldap_next_attribute (ldap , ldap_result_entry , ber );
1079
1082
}
1083
+ #if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP || WINDOWS
1084
+ if (ber != NULL )
1085
+ ber_free (ber , 0 );
1086
+ #endif
1080
1087
1081
1088
add_assoc_long (return_value , "count" , num_attrib );
1082
1089
}
@@ -1185,7 +1192,7 @@ PHP_FUNCTION(ldap_get_dn)
1185
1192
text = ldap_get_dn (ldap , ldap_result_entry );
1186
1193
if ( text != NULL ) {
1187
1194
RETVAL_STRING (text ,1 );
1188
- #ifdef WINDOWS
1195
+ #if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP || WINDOWS
1189
1196
ldap_memfree (text );
1190
1197
#endif
1191
1198
} else {
@@ -1245,7 +1252,7 @@ PHP_FUNCTION(ldap_dn2ufn)
1245
1252
1246
1253
if (ufn != NULL ) {
1247
1254
RETVAL_STRING (ufn ,1 );
1248
- #ifdef WINDOWS
1255
+ #if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP || WINDOWS
1249
1256
ldap_memfree (ufn );
1250
1257
#endif
1251
1258
} else {
0 commit comments