]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/unbind.c
ITS#4052,4053 plug mem leaks
[openldap] / libraries / libldap / unbind.c
index 678a2804aec0356a47cf37d69b8edd7cda20edd5..8966df8a4938ab5dd942a30fd411660a5dcb968c 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2004 The OpenLDAP Foundation.
+ * Copyright 1998-2005 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -144,6 +144,13 @@ ldap_ld_free(
                ld->ld_options.ldo_defludp = NULL;
        }
 
+#ifdef LDAP_CONNECTIONLESS
+       if ( ld->ld_options.ldo_peer != NULL ) {
+               LDAP_FREE( ld->ld_options.ldo_peer );
+               ld->ld_options.ldo_peer = NULL;
+       }
+#endif
+
        if ( ld->ld_options.ldo_tm_api != NULL ) {
                LDAP_FREE( ld->ld_options.ldo_tm_api );
                ld->ld_options.ldo_tm_api = NULL;
@@ -176,6 +183,16 @@ ldap_ld_free(
        }
 #endif
 
+       if ( ld->ld_options.ldo_sctrls != NULL ) {
+               ldap_controls_free( ld->ld_options.ldo_sctrls );
+               ld->ld_options.ldo_sctrls = NULL;
+       }
+
+       if ( ld->ld_options.ldo_cctrls != NULL ) {
+               ldap_controls_free( ld->ld_options.ldo_cctrls );
+               ld->ld_options.ldo_cctrls = NULL;
+       }
+
        ber_sockbuf_free( ld->ld_sb );   
    
 #ifdef LDAP_R_COMPILE