openldap: fix leak when reading from server fails
authorMarc Fournier <marc.fournier@camptocamp.com>
Mon, 30 Jun 2014 14:42:54 +0000 (16:42 +0200)
committerMarc Fournier <marc.fournier@camptocamp.com>
Fri, 29 Aug 2014 13:09:18 +0000 (15:09 +0200)
src/openldap.c

index 166dcec..f284a19 100644 (file)
@@ -328,6 +328,7 @@ static int 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);
                        return (-1);
                }
        }
@@ -342,6 +343,7 @@ static int 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);
                return (-1);
        }
        else