s3:smbldap: add a destructor to smbldap_state, just in case
authorGregor Beck <gbeck@sernet.de>
Tue, 21 Jun 2011 06:06:28 +0000 (08:06 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 1 Jul 2011 09:23:56 +0000 (11:23 +0200)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
source3/lib/smbldap.c

index 41ba0e1b442f0f89356e4888dacd0e8a087ae507..1fbefbf2d59934022a6021e27c226133cb5efe23 100644 (file)
@@ -1853,6 +1853,12 @@ void smbldap_free_struct(struct smbldap_state **ldap_state)
        /* No need to free any further, as it is talloc()ed */
 }
 
+static int smbldap_state_destructor(struct smbldap_state *state)
+{
+       smbldap_free_struct(&state);
+       return 0;
+}
+
 
 /**********************************************************************
  Intitalise the 'general' ldap structures, on which ldap operations may be conducted
@@ -1876,6 +1882,7 @@ NTSTATUS smbldap_init(TALLOC_CTX *mem_ctx, struct event_context *event_ctx,
 
        (*smbldap_state)->event_context = event_ctx;
 
+       talloc_set_destructor(*smbldap_state, smbldap_state_destructor);
        return NT_STATUS_OK;
 }