From dcad3d956996051178e67df266a2d300a3413f94 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Wed, 10 May 2000 16:36:46 +0000 Subject: [PATCH] Undo slapd/add.c rev 1.54; back-bdb2 and back-ldbm were the only backends 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 | 2 +- servers/slapd/back-bdb2/add.c | 10 ---------- servers/slapd/back-ldbm/add.c | 10 ---------- 3 files changed, 1 insertion(+), 21 deletions(-) diff --git a/servers/slapd/add.c b/servers/slapd/add.c index e7819727fa..62a542f2f7 100644 --- a/servers/slapd/add.c +++ b/servers/slapd/add.c @@ -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 { diff --git a/servers/slapd/back-bdb2/add.c b/servers/slapd/back-bdb2/add.c index 2ab81e76a6..4660da8710 100644 --- a/servers/slapd/back-bdb2/add.c +++ b/servers/slapd/back-bdb2/add.c @@ -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 ); diff --git a/servers/slapd/back-ldbm/add.c b/servers/slapd/back-ldbm/add.c index 8623e25040..1cac236358 100644 --- a/servers/slapd/back-ldbm/add.c +++ b/servers/slapd/back-ldbm/add.c @@ -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 ); -- 2.39.5