]> 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@symas.com>
Sun, 18 Jan 2015 14:01:05 +0000 (14:01 +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 91facca824085710812bb1ca01f3b0283a80771d..e68ad62baeae9d3df449c86da681b0ff67d5edae 100644 (file)
@@ -832,6 +832,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 ) {
@@ -856,11 +861,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 d286be7f254646a544cdf112c29274fb61ef38aa..aaae71c37bf0f3a20e2ef5ddacf8c994f6b5e090 100644 (file)
@@ -1847,7 +1847,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 33f191796e01cd05cfa50de672709f079373a6a8..80bfe5ea6f2055fcc70c76a130e9824ecce9626f 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 1f37649af5ac7db3e9e768193623de0bcda7e083..dcc6cc225d072d14f4e08284c1e05ffd01041f84 100644 (file)
@@ -826,7 +826,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 3bf46ea69ac48f68e0d4f6bd41ee00fc7b812ced..ede8d2402f758c1d9910d07b4bc7b334b6fbe167 100644 (file)
@@ -383,7 +383,7 @@ txnReturn:
                                rs->sr_err = LDAP_OTHER;
                                goto return_results;
                        }
-                       new_parent_dn = &np->e_name;
+                       np_dn = &np->e_name;
 
                } else {
                        np_dn = NULL;
index eef1a2aa68f7b51c847eff1bd92f6f6c19b0dbb8..588fabf61676699dd7297986e192f423ca8d447c 100644 (file)
@@ -360,10 +360,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 ) {