From: Howard Chu Date: Wed, 14 Jan 2015 12:55:34 +0000 (+0000) Subject: Minor cleanup (coverity) X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=bc3dbcbde931f64e806517e7aac20b3f4ac51be3;p=openldap Minor cleanup (coverity) --- diff --git a/servers/slapd/back-bdb/tools.c b/servers/slapd/back-bdb/tools.c index c0ce3a2cf8..e420f5d7e0 100644 --- a/servers/slapd/back-bdb/tools.c +++ b/servers/slapd/back-bdb/tools.c @@ -841,6 +841,11 @@ int bdb_tool_entry_reindex( return -1; } + op.o_hdr = &ohdr; + op.o_bd = be; + op.o_tmpmemctx = NULL; + op.o_tmpmfuncs = &ch_mfuncs; + if (! (slapMode & SLAP_TOOL_QUICK)) { rc = TXN_BEGIN( bi->bi_dbenv, NULL, &tid, bi->bi_db_opflags ); if( rc != 0 ) { @@ -865,11 +870,6 @@ int bdb_tool_entry_reindex( "=> " LDAP_XSTRING(bdb_tool_entry_reindex) "( %ld, \"%s\" )\n", (long) id, e->e_dn, 0 ); - op.o_hdr = &ohdr; - op.o_bd = be; - op.o_tmpmemctx = NULL; - op.o_tmpmfuncs = &ch_mfuncs; - rc = bdb_tool_index_add( &op, tid, e ); done: diff --git a/servers/slapd/back-dnssrv/search.c b/servers/slapd/back-dnssrv/search.c index 2a3fb67726..e0d1e5795e 100644 --- a/servers/slapd/back-dnssrv/search.c +++ b/servers/slapd/back-dnssrv/search.c @@ -228,7 +228,7 @@ dnssrv_back_search( send_ldap_result( op, rs ); } - if ( refdn ) free( refdn ); + free( refdn ); if ( nrefdn.bv_val ) free( nrefdn.bv_val ); done: diff --git a/servers/slapd/back-ldap/bind.c b/servers/slapd/back-ldap/bind.c index 1718e612d3..4db8215f1d 100644 --- a/servers/slapd/back-ldap/bind.c +++ b/servers/slapd/back-ldap/bind.c @@ -1845,7 +1845,7 @@ retry:; * LDAP_COMPARE_{TRUE|FALSE}) */ default: /* only touch when activity actually took place... */ - if ( li->li_idle_timeout && lc ) { + if ( li->li_idle_timeout ) { lc->lc_time = op->o_time; } diff --git a/servers/slapd/back-ldap/distproc.c b/servers/slapd/back-ldap/distproc.c index e9ab6d7ef4..b925ed6093 100644 --- a/servers/slapd/back-ldap/distproc.c +++ b/servers/slapd/back-ldap/distproc.c @@ -423,7 +423,8 @@ distproc_ldadd( CfEntryInfo *p, Entry *e, ConfigArgs *ca ) Debug( LDAP_DEBUG_ANY, "slapd-distproc: " "unable to init %sunderlying database \"%s\".\n", lc->lc_common_li == NULL ? "common " : "", e->e_name.bv_val, 0 ); - return LDAP_CONSTRAINT_VIOLATION; + rc = LDAP_CONSTRAINT_VIOLATION; + goto done; } li = ca->be->be_private; diff --git a/servers/slapd/back-ldap/extended.c b/servers/slapd/back-ldap/extended.c index 5e98f9acc9..ade03b0667 100644 --- a/servers/slapd/back-ldap/extended.c +++ b/servers/slapd/back-ldap/extended.c @@ -201,7 +201,7 @@ retry: } else { /* only touch when activity actually took place... */ - if ( li->li_idle_timeout && lc ) { + if ( li->li_idle_timeout ) { lc->lc_time = op->o_time; } @@ -332,7 +332,7 @@ retry: } else { /* only touch when activity actually took place... */ - if ( li->li_idle_timeout && lc ) { + if ( li->li_idle_timeout ) { lc->lc_time = op->o_time; } diff --git a/servers/slapd/back-ldap/search.c b/servers/slapd/back-ldap/search.c index eeab466a56..d7afed7553 100644 --- a/servers/slapd/back-ldap/search.c +++ b/servers/slapd/back-ldap/search.c @@ -338,7 +338,7 @@ retry: } else { /* only touch when activity actually took place... */ - if ( li->li_idle_timeout && lc ) { + if ( li->li_idle_timeout ) { lc->lc_time = op->o_time; } diff --git a/servers/slapd/back-ldif/ldif.c b/servers/slapd/back-ldif/ldif.c index 71b5865691..246c6a3bdc 100644 --- a/servers/slapd/back-ldif/ldif.c +++ b/servers/slapd/back-ldif/ldif.c @@ -827,7 +827,6 @@ ldif_readdir( if ( rs != NULL ) rs->sr_text = save_errno != ENOENT ? "internal error (bad directory)" - : !is_rootDSE ? "internal error (missing directory)" : "internal error (database directory does not exist)"; } diff --git a/servers/slapd/back-mdb/modrdn.c b/servers/slapd/back-mdb/modrdn.c index aa1be8cf6b..5880c91265 100644 --- a/servers/slapd/back-mdb/modrdn.c +++ b/servers/slapd/back-mdb/modrdn.c @@ -346,7 +346,7 @@ mdb_modrdn( Operation *op, SlapReply *rs ) rs->sr_err = LDAP_OTHER; goto return_results; } - new_parent_dn = &np->e_name; + np_dn = &np->e_name; } else { np_dn = NULL; diff --git a/servers/slapd/back-mdb/tools.c b/servers/slapd/back-mdb/tools.c index a84de6f4c8..66eb999d4c 100644 --- a/servers/slapd/back-mdb/tools.c +++ b/servers/slapd/back-mdb/tools.c @@ -383,10 +383,6 @@ mdb_tool_entry_get_int( BackendDB *be, ID id, Entry **ep ) rc = mdb_id2name( &op, mdb_tool_txn, &idcursor, id, &dn, &ndn ); if ( rc ) { rc = LDAP_OTHER; - if ( e ) { - mdb_entry_return( &op, e ); - e = NULL; - } goto done; } if ( tool_base != NULL ) { @@ -610,7 +606,7 @@ mdb_tool_index_add( static int mdb_tool_index_finish() { - int i, rc; + int i, rc = 0; ldap_pvt_thread_mutex_lock( &mdb_tool_index_mutex ); for ( i=1; i