]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-mdb/attr.c
Add debug msg if adding entry to logDB fails
[openldap] / servers / slapd / back-mdb / attr.c
index e534a7c5ef90e7d6b9c0ff3e04f156e78359b566..c0f64517da062f80a9c7bd743418355e5fb69607 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2000-2013 The OpenLDAP Foundation.
+ * Copyright 2000-2017 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -309,6 +309,10 @@ mdb_attr_index_config(
                                fprintf( stderr, "%s: line %d: %s\n",
                                        fname, lineno, c_reply->msg );
                        }
+fail:
+#ifdef LDAP_COMP_MATCH
+                       ch_free( cr );
+#endif
                        goto done;
                }
 
@@ -320,7 +324,7 @@ mdb_attr_index_config(
                                        fname, lineno, c_reply->msg );
                        }
                        rc = LDAP_UNWILLING_TO_PERFORM;
-                       goto done;
+                       goto fail;
                }
 
                if( IS_SLAP_INDEX( mask, SLAP_INDEX_APPROX ) && !(
@@ -335,7 +339,7 @@ mdb_attr_index_config(
                                        fname, lineno, c_reply->msg );
                        }
                        rc = LDAP_INAPPROPRIATE_MATCHING;
-                       goto done;
+                       goto fail;
                }
 
                if( IS_SLAP_INDEX( mask, SLAP_INDEX_EQUALITY ) && !(
@@ -350,7 +354,7 @@ mdb_attr_index_config(
                                        fname, lineno, c_reply->msg );
                        }
                        rc = LDAP_INAPPROPRIATE_MATCHING;
-                       goto done;
+                       goto fail;
                }
 
                if( IS_SLAP_INDEX( mask, SLAP_INDEX_SUBSTR ) && !(
@@ -365,7 +369,7 @@ mdb_attr_index_config(
                                        fname, lineno, c_reply->msg );
                        }
                        rc = LDAP_INAPPROPRIATE_MATCHING;
-                       goto done;
+                       goto fail;
                }
 
                Debug( LDAP_DEBUG_CONFIG, "index %s 0x%04lx\n",
@@ -398,11 +402,12 @@ mdb_attr_index_config(
                                 * just add the extracted component reference
                                 * in the AttrInfo
                                 */
+                               ch_free( a );
                                rc = insert_component_reference( cr, &a_cr->ai_cr );
                                if ( rc != LDAP_SUCCESS) {
                                        fprintf( stderr, " error during inserting component reference in %s ", attrs[i]);
                                        rc = LDAP_PARAM_ERROR;
-                                       goto done;
+                                       goto fail;
                                }
                                continue;
                        } else {
@@ -410,7 +415,8 @@ mdb_attr_index_config(
                                if ( rc != LDAP_SUCCESS) {
                                        fprintf( stderr, " error during inserting component reference in %s ", attrs[i]);
                                        rc = LDAP_PARAM_ERROR;
-                                       goto done;
+                                       ch_free( a );
+                                       goto fail;
                                }
                        }
                }
@@ -617,7 +623,7 @@ int mdb_ad_get( struct mdb_info *mdb, MDB_txn *txn, AttributeDescription *ad )
        if ( rc == MDB_SUCCESS ) {
                mdb->mi_adxs[ad->ad_index] = i;
                mdb->mi_ads[i] = ad;
-               mdb->mi_numads++;
+               mdb->mi_numads = i;
        } else {
                Debug( LDAP_DEBUG_ANY,
                        "mdb_ad_get: mdb_put failed %s(%d)\n",