openldap: use ldap_unbind_ext_s() to avoid memory leak
authorMarc Fournier <marc.fournier@camptocamp.com>
Tue, 1 Jul 2014 15:31:07 +0000 (17:31 +0200)
committerMarc Fournier <marc.fournier@camptocamp.com>
Fri, 29 Aug 2014 13:09:52 +0000 (15:09 +0200)
... as ldap_destroy() is only available in newer libldap versions.

src/openldap.c

index 5a04578..7ce789f 100644 (file)
@@ -94,7 +94,7 @@ static int ldap_init_host (ldap_t *st) /* {{{ */
                        ERROR ("openldap plugin: Failed to start tls on %s: %s",
                                        st->url, ldap_err2string (rc));
                        st->state = 0;
-                       ldap_destroy(st->ld);
+                       ldap_unbind_ext_s(st->ld, NULL, NULL);
                        return (-1);
                }
        }
@@ -109,7 +109,7 @@ static int ldap_init_host (ldap_t *st) /* {{{ */
                ERROR ("openldap plugin: Failed to bind to %s: %s",
                                st->url, ldap_err2string (rc));
                st->state = 0;
-               ldap_destroy(st->ld);
+               ldap_unbind_ext_s(st->ld, NULL, NULL);
                return (-1);
        }
        else