From 3ad55b225e30ca6bf9b47b2afa0abf2c240601d8 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Wed, 3 Oct 2001 23:39:29 +0000 Subject: [PATCH] Add error handling to BDB_INDEX code --- servers/slapd/back-bdb/modify.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/servers/slapd/back-bdb/modify.c b/servers/slapd/back-bdb/modify.c index d9fe477ccf..f2e015cbf1 100644 --- a/servers/slapd/back-bdb/modify.c +++ b/servers/slapd/back-bdb/modify.c @@ -130,13 +130,26 @@ int bdb_modify_internal( #if BDB_INDEX /* delete indices for old attributes */ rc = bdb_index_entry_del( be, tid, e, save_attrs); + if ( rc != LDAP_SUCCESS ) { + attrs_free( e->e_attrs ); + e->e_attrs = save_attrs; + Debug( LDAP_DEBUG_ANY, "entry index delete failed: %s\n", + *text, 0, 0 ); + return rc; + } /* add indices for new attributes */ - rc = bdb_index_entry_add( be, tid, e, e->e_attrs); + rc = bdb_index_entry_add( be, tid, e, e->e_attrs); + if ( rc != LDAP_SUCCESS ) { + attrs_free( e->e_attrs ); + e->e_attrs = save_attrs; + Debug( LDAP_DEBUG_ANY, "entry index add failed: %s\n", + *text, 0, 0 ); + return rc; + } #endif attrs_free( save_attrs ); - return rc; } -- 2.39.5