diff --git a/c/ldap.c b/c/ldap.c index 7009ca2..b13b6cd 100644 --- a/c/ldap.c +++ b/c/ldap.c @@ -323,9 +323,12 @@ s48_value scsh_ldap_first_attribute(s48_value ldap, s48_value entry) &ber); if (name == NULL) res_list = s48_list_2(S48_FALSE, S48_FALSE); - else + else { res_list = s48_list_2(s48_enter_string(name), scsh_enter_berelement(ber)); + ldap_memfree(name); + } + S48_GC_UNPROTECT(); return res_list; } @@ -340,7 +343,13 @@ s48_value scsh_ldap_next_attribute(s48_value ldap, s48_value entry, s48_value be name = ldap_next_attribute(scsh_extract_ldap(ldap), scsh_extract_ldapmessage(entry), scsh_extract_berelement(ber)); - res = (name != NULL) ? s48_enter_string(name) : S48_FALSE; + if (name == NULL) + res = S48_FALSE; + else { + res = s48_enter_string(name); + ldap_memfree(name); + } + S48_GC_UNPROTECT(); return res; }