]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/overlays/dynlist.c
Happy New Year
[openldap] / servers / slapd / overlays / dynlist.c
index 0b7f994555d8ea2929e11560db81a0366a4a655d..6293889f04ea1682d8c246d8bead8ffe784c05db 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2003-2013 The OpenLDAP Foundation.
+ * Copyright 2003-2018 The OpenLDAP Foundation.
  * Portions Copyright 2004-2005 Pierangelo Masarati.
  * Portions Copyright 2008 Emmanuel Dreyfus.
  * All rights reserved.
@@ -346,7 +346,7 @@ static int
 dynlist_prepare_entry( Operation *op, SlapReply *rs, dynlist_info_t *dli )
 {
        Attribute       *a, *id = NULL;
-       slap_callback   cb;
+       slap_callback   cb = { 0 };
        Operation       o = *op;
        struct berval   *url;
        Entry           *e;
@@ -404,8 +404,6 @@ dynlist_prepare_entry( Operation *op, SlapReply *rs, dynlist_info_t *dli )
        dlc.dlc_dli = dli;
        cb.sc_private = &dlc;
        cb.sc_response = dynlist_sc_update;
-       cb.sc_cleanup = NULL;
-       cb.sc_next = NULL;
 
        o.o_callback = &cb;
        o.ors_deref = LDAP_DEREF_NEVER;
@@ -1158,6 +1156,12 @@ done_uri:;
                                        filter_free( filter );
                                }
 
+                               while ( dlm != NULL ) {
+                                       dlml = dlm;
+                                       dlm = dlm->dlm_next;
+                                       ch_free( dlml );
+                               }
+
                                Debug( LDAP_DEBUG_ANY, "%s: %s.\n",
                                        c->log, c->cr_msg, 0 );
 
@@ -1174,7 +1178,8 @@ done_uri:;
                                c->argv[ attridx ] );
                        Debug( LDAP_DEBUG_ANY, "%s: %s.\n",
                                c->log, c->cr_msg, 0 );
-                       return 1;
+                       rc = 1;
+                       goto done_uri;
                }
 
                if ( !is_at_subtype( ad->ad_type, slap_schema.si_ad_labeledURI->ad_type ) ) {
@@ -1184,7 +1189,8 @@ done_uri:;
                                c->argv[ attridx ] );
                        Debug( LDAP_DEBUG_ANY, "%s: %s.\n",
                                c->log, c->cr_msg, 0 );
-                       return 1;
+                       rc = 1;
+                       goto done_uri;
                }
 
                attridx++;
@@ -1213,7 +1219,8 @@ done_uri:;
                                                i - 3, c->argv[ i ] );
                                        Debug( LDAP_DEBUG_ANY, "%s: %s.\n",
                                                c->log, c->cr_msg, 0 );
-                                       return 1;
+                                       rc = 1;
+                                       goto done_uri;
                                }
                                arg = cp + 1;
                        }
@@ -1226,7 +1233,8 @@ done_uri:;
                                        i - 3, c->argv[ i ] );
                                Debug( LDAP_DEBUG_ANY, "%s: %s.\n",
                                        c->log, c->cr_msg, 0 );
-                               return 1;
+                               rc = 1;
+                               goto done_uri;
                        }
 
                        dlmp = (dynlist_map_t *)ch_calloc( 1, sizeof( dynlist_map_t ) );
@@ -1255,7 +1263,8 @@ done_uri:;
                                                c->valx );
                                        Debug( LDAP_DEBUG_ANY, "%s: %s.\n",
                                                c->log, c->cr_msg, 0 );
-                                       return 1;
+                                       rc = 1;
+                                       goto done_uri;
                                }
                                dlip = &(*dlip)->dli_next;
                        }