Browse Source

Bug 750625 - Fix Coverity (11091) Unchecked return value

https://bugzilla.redhat.com/show_bug.cgi?id=750625

slapd/back-ldbm/import-threads.c (index_producer)

Bug Description: No check of the return value of "db_create".

Fix Description: Adding a checking code for the return value
from db_create.
Noriko Hosoi 14 years ago
parent
commit
950712cfcc
1 changed files with 9 additions and 4 deletions
  1. 9 4
      ldap/servers/slapd/back-ldbm/import-threads.c

+ 9 - 4
ldap/servers/slapd/back-ldbm/import-threads.c

@@ -1148,9 +1148,8 @@ index_producer(void *param)
         tmp_db->close(tmp_db, 0);
         rc = db_create(&db, env, 0);
         if (rc) {
-            LDAPDebug2Args(LDAP_DEBUG_ANY,
-                           "Creating db handle to rename %s to %s failed.\n",
-                           tmpid2entry, id2entry);
+            LDAPDebug1Arg(LDAP_DEBUG_ANY,
+                         "Creating db handle to remove %s failed.\n", id2entry);
             goto bail;
         }
         rc = db->remove(db, id2entry, NULL, 0);
@@ -1158,7 +1157,13 @@ index_producer(void *param)
             LDAPDebug1Arg(LDAP_DEBUG_ANY, "Removing %s failed.\n", id2entry);
             goto bail;
         }
-        db_create(&db, env, 0);
+        rc = db_create(&db, env, 0);
+        if (rc) {
+            LDAPDebug2Args(LDAP_DEBUG_ANY,
+                           "Creating db handle to rename %s to %s failed.\n",
+                           tmpid2entry, id2entry);
+            goto bail;
+        }
         rc = db->rename(db, tmpid2entry, NULL, id2entry, 0);
         if (rc) {
             LDAPDebug2Args(LDAP_DEBUG_ANY, "Renaming %s to %s failed.\n",