]> git.sur5r.net Git - openldap/commitdiff
Minor cleanup (coverity)
authorHoward Chu <hyc@openldap.org>
Wed, 14 Jan 2015 12:55:34 +0000 (12:55 +0000)
committerHoward Chu <hyc@openldap.org>
Wed, 14 Jan 2015 13:27:45 +0000 (13:27 +0000)
servers/slapd/back-bdb/tools.c
servers/slapd/back-dnssrv/search.c
servers/slapd/back-ldap/bind.c
servers/slapd/back-ldap/distproc.c
servers/slapd/back-ldap/extended.c
servers/slapd/back-ldap/search.c
servers/slapd/back-ldif/ldif.c
servers/slapd/back-mdb/modrdn.c
servers/slapd/back-mdb/tools.c

index c0ce3a2cf80cb82f0947cff5826dd895cd880574..e420f5d7e04548b111fdc81894f937dfd0ed56fe 100644 (file)
@@ -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:
index 2a3fb67726eca04bd6e6944d94f2d5184c5aa691..e0d1e5795e135492e69f8ec501fa1d9556cd2e28 100644 (file)
@@ -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:
index 1718e612d302c97195f7066349410cd3bf5151fd..4db8215f1ddc48214ab8a4b921aaebbb19d3797d 100644 (file)
@@ -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;
                        }
 
index e9ab6d7ef4eced6bcf9a89e2330b76ddf04f72d4..b925ed6093d2acba63a1cca2931bb9a592e72207 100644 (file)
@@ -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;
index 5e98f9acc97663d71c2180d880c762d775577746..ade03b06678c62a22bef74b68484d9460f40130c 100644 (file)
@@ -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;
                        }
 
index eeab466a568a229bc0eee54d1b014874d8ab9469..d7afed7553229949e850a63f80f33b267aee6fc6 100644 (file)
@@ -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;
                        }
 
index 71b58656912a7f1a1a54d941e2f64c46a33807f7..246c6a3bdc3db3eb5cd3ca486a679934c1f54190 100644 (file)
@@ -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)";
                }
 
index aa1be8cf6b27feac90ae5558c91f638295c7d800..5880c91265e68012ddacc68004b1dcb9964afd2b 100644 (file)
@@ -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;
index a84de6f4c8f4d43ee75c2d49349f984c049cfcf4..66eb999d4c0950afed5832a66092891ae5bc9caa 100644 (file)
@@ -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<mdb_tool_threads; i++ ) {
                if ( mdb_tool_index_rec[i].ir_i == LDAP_BUSY ) {