From a2dec53772cc1f5f72e701dddf16430229851485 Mon Sep 17 00:00:00 2001 From: Rich Megginson <rmeggins@xxxxxxxxxx> Date: Fri, 25 May 2012 12:39:09 -0600 Subject: [PATCH] fix coverity issues with uninit vals, no return checking 12766 Uninitialized pointer read In _entryrdn_replace_suffix_id(): Reads an uninitialized pointer or its target 12765 Uninitialized pointer read In txn_test_threadmain(): Reads an uninitialized pointer or its target 12764 Unchecked return value In txn_test_threadmain(): Value returned from a function is not checked for errors before being used 12763 Unchecked return value In entrycache_replace(): Value returned from a function is not checked for errors before being used 12762 Unchecked return value In entrycache_add_int(): Value returned from a function is not checked for errors before being used --- ldap/servers/slapd/back-ldbm/cache.c | 8 ++++++-- ldap/servers/slapd/back-ldbm/dblayer.c | 9 ++++----- ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c | 1 + 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/ldap/servers/slapd/back-ldbm/cache.c b/ldap/servers/slapd/back-ldbm/cache.c index 045b1eb..de84700 100644 --- a/ldap/servers/slapd/back-ldbm/cache.c +++ b/ldap/servers/slapd/back-ldbm/cache.c @@ -1058,7 +1058,9 @@ static int entrycache_replace(struct cache *cache, struct backentry *olde, } if (!add_hash(cache->c_idtable, &(newe->ep_id), sizeof(ID), newe, NULL)) { LOG("entry cache replace: can't add id\n", 0, 0, 0); - remove_hash(cache->c_dntable, (void *)newndn, strlen(newndn)); + if (remove_hash(cache->c_dntable, (void *)newndn, strlen(newndn))) { + LOG("entry cache replace: can't remove dn after add id failed\n", 0, 0, 0); + } PR_Unlock(cache->c_mutex); return 1; } @@ -1357,7 +1359,9 @@ entrycache_add_int(struct cache *cache, struct backentry *e, int state, PR_Unlock(cache->c_mutex); return 0; } - remove_hash(cache->c_dntable, (void *)ndn, strlen(ndn)); + if (remove_hash(cache->c_dntable, (void *)ndn, strlen(ndn))) { + LOG("=>= entrycache_add_int could not remove existing id from dn cache\n", 0, 0, 0); + } e->ep_state |= ENTRY_STATE_NOTINCACHE; PR_Unlock(cache->c_mutex); return -1; diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c index 09d10a0..90e48af 100644 --- a/ldap/servers/slapd/back-ldbm/dblayer.c +++ b/ldap/servers/slapd/back-ldbm/dblayer.c @@ -3897,12 +3897,12 @@ static int txn_test_threadmain(void *param) INCR_THREAD_COUNT(priv); + txn_test_init_cfg(&cfg); + if (!priv->dblayer_enable_transactions) { goto end; } - txn_test_init_cfg(&cfg); - wait_for_init: free_ttilist(&ttilist, &tticnt); DS_Sleep(PR_MillisecondsToInterval(1000)); @@ -3941,9 +3941,8 @@ wait_for_init: object_release(inst_obj); goto wait_for_init; } - dblayer_get_index_file(be, ai, &db, 0); - if (NULL == db) { - if (strcasecmp(*idx, TXN_TEST_IDX_OK_IF_NULL)) { + if (dblayer_get_index_file(be, ai, &db, 0) || (NULL == db)) { + if ((NULL == db) && strcasecmp(*idx, TXN_TEST_IDX_OK_IF_NULL)) { object_release(inst_obj); goto wait_for_init; } diff --git a/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c b/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c index 449e02a..0541543 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c +++ b/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c @@ -2179,6 +2179,7 @@ _entryrdn_replace_suffix_id(DBC *cursor, DBT *key, DBT *adddata, size_t curr_childnum = 0; int db_retry = 0; + memset(&moddata, 0, sizeof(moddata)); /* temporary id added for the non exisiting suffix */ /* Let's replace it with the real entry ID */ /* SELF */ -- 1.7.1
-- 389-devel mailing list 389-devel@xxxxxxxxxxxxxxxxxxxxxxx https://admin.fedoraproject.org/mailman/listinfo/389-devel