]> git.sur5r.net Git - openldap/commitdiff
Undo slapd/add.c rev 1.54; back-bdb2 and back-ldbm were the only backends
authorHoward Chu <hyc@openldap.org>
Wed, 10 May 2000 16:36:46 +0000 (16:36 +0000)
committerHoward Chu <hyc@openldap.org>
Wed, 10 May 2000 16:36:46 +0000 (16:36 +0000)
that called entry_free() on failure. This change would cause a memory leak
from all the other backends. Instead, remove the entry_free calls in these
two backends and let the frontend take care of it for everyone.

servers/slapd/add.c
servers/slapd/back-bdb2/add.c
servers/slapd/back-ldbm/add.c

index e7819727facee2313e82b245f1becaa0b1fb7f27..62a542f2f7faa7d44c86089ac8334701afe7f79d 100644 (file)
@@ -261,8 +261,8 @@ do_add( Connection *conn, Operation *op )
                                        replog( be, op, e->e_dn, e );
                                }
                                be_entry_release_w( be, e );
+                               e = NULL;
                        }
-                       e = NULL;
 
 #ifndef SLAPD_MULTIMASTER
                } else {
index 2ab81e76a6ff935043f47d4d643b956cd7eca11d..4660da871057d7a862e634f95a969e193a1aac83 100644 (file)
@@ -32,7 +32,6 @@ bdb2i_back_add_internal(
        Debug(LDAP_DEBUG_ARGS, "==> bdb2i_back_add: %s\n", e->e_dn, 0, 0);
 
        if ( ( bdb2i_dn2id( be, e->e_ndn ) ) != NOID ) {
-               entry_free( e );
                send_ldap_result( conn, op, LDAP_ALREADY_EXISTS,
                        NULL, NULL, NULL, NULL );
                return( -1 );
@@ -42,7 +41,6 @@ bdb2i_back_add_internal(
                Debug( LDAP_DEBUG_TRACE, "entry failed schema check\n",
                        0, 0, 0 );
 
-               entry_free( e );
                send_ldap_result( conn, op, LDAP_OBJECT_CLASS_VIOLATION,
                        NULL, NULL, NULL, NULL );
                return( -1 );
@@ -90,7 +88,6 @@ bdb2i_back_add_internal(
                                free( matched_dn );
                        }
 
-                       entry_free( e );
                        free( pdn );
                        return -1;
                }
@@ -108,7 +105,6 @@ bdb2i_back_add_internal(
                        send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS,
                            NULL, NULL, NULL, NULL );
 
-                       entry_free( e );
                        return -1;
                }
 
@@ -124,7 +120,6 @@ bdb2i_back_add_internal(
                        send_ldap_result( conn, op, LDAP_ALIAS_PROBLEM,
                            NULL, NULL, NULL, NULL );
 
-                       entry_free( e );
                        return -1;
                }
 
@@ -145,7 +140,6 @@ bdb2i_back_add_internal(
 
                        ber_bvecfree( refs );
                        free( matched_dn );
-                       entry_free( e );
                        return -1;
                }
 
@@ -164,7 +158,6 @@ bdb2i_back_add_internal(
                        send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS,
                            NULL, NULL, NULL, NULL );
 
-                       entry_free( e );
                        return -1;
                }
        }
@@ -189,9 +182,6 @@ bdb2i_back_add_internal(
                Debug( LDAP_DEBUG_ANY, "cache_add_entry_lock failed\n", 0, 0,
                    0 );
 
-               /* free the entry */
-               entry_free( e );
-
                send_ldap_result( conn, op,
                        rc > 0 ? LDAP_ALREADY_EXISTS : LDAP_OPERATIONS_ERROR,
                        NULL, NULL, NULL, NULL );
index 8623e2504018a35ce96c6aa36a28729af37592e1..1cac236358217352dca8ed6e4fc46b49eacbd097 100644 (file)
@@ -44,7 +44,6 @@ ldbm_back_add(
 
        if ( ( dn2id( be, e->e_ndn ) ) != NOID ) {
                ldap_pvt_thread_mutex_unlock(&li->li_add_mutex);
-               entry_free( e );
                send_ldap_result( conn, op, LDAP_ALREADY_EXISTS,
                        NULL, NULL, NULL, NULL );
                return( -1 );
@@ -58,7 +57,6 @@ ldbm_back_add(
                Debug( LDAP_DEBUG_TRACE, "entry failed schema check: %s\n",
                        text, 0, 0 );
 
-               entry_free( e );
                send_ldap_result( conn, op, rc,
                        NULL, text, NULL, NULL );
                return( -1 );
@@ -107,7 +105,6 @@ ldbm_back_add(
                                free( matched_dn );
                        }
 
-                       entry_free( e );
                        free( pdn );
                        return -1;
                }
@@ -129,7 +126,6 @@ ldbm_back_add(
                            NULL, "no write access to parent", NULL, NULL );
 
 
-                       entry_free( e );
                        return -1;
                }
 
@@ -145,7 +141,6 @@ ldbm_back_add(
                        send_ldap_result( conn, op, LDAP_ALIAS_PROBLEM,
                            NULL, "parent is an alias", NULL, NULL );
 
-                       entry_free( e );
                        return -1;
                }
 
@@ -166,7 +161,6 @@ ldbm_back_add(
 
                        ber_bvecfree( refs );
                        free( matched_dn );
-                       entry_free( e );
                        return -1;
                }
 
@@ -187,7 +181,6 @@ ldbm_back_add(
                        send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS,
                            NULL, NULL, NULL, NULL );
 
-                       entry_free( e );
                        return -1;
                }
 
@@ -221,9 +214,6 @@ ldbm_back_add(
                Debug( LDAP_DEBUG_ANY, "cache_add_entry_lock failed\n", 0, 0,
                    0 );
 
-               /* free the entry */
-               entry_free( e );
-
                send_ldap_result( conn, op,
                        rc > 0 ? LDAP_ALREADY_EXISTS : LDAP_OTHER,
                        NULL, rc > 0 ? NULL : "cache add failed", NULL, NULL );