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.
This commit is contained in:
Howard Chu 2000-05-10 16:36:46 +00:00
parent 9842b8fa87
commit dcad3d9569
3 changed files with 1 additions and 21 deletions

View 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 {

View 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 );

View 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 );