]> git.sur5r.net Git - openldap/commitdiff
plug unlikely memleak (coverity)
authorHoward Chu <hyc@openldap.org>
Tue, 13 Jan 2015 22:43:18 +0000 (22:43 +0000)
committerHoward Chu <hyc@openldap.org>
Tue, 13 Jan 2015 22:48:07 +0000 (22:48 +0000)
servers/slapd/back-bdb/dbcache.c
servers/slapd/back-bdb/init.c

index d3044ef6dc495062a12f679b7323624468b96fda..da057676cb8e937eb6cd8a93ced5a4dfa0d9bd17 100644 (file)
@@ -195,6 +195,8 @@ bdb_db_cache(
                        "bdb_db_cache: db_open(%s) failed: %s (%d)\n",
                        name->bv_val, db_strerror(rc), rc );
                ldap_pvt_thread_mutex_unlock( &bdb->bi_database_mutex );
+               db->bdi_db->close( db->bdi_db, 0 );
+               ch_free( db );
                return rc;
        }
 
index f08b113e7899d5436a848e79bf9f0a97a7fe3489..d1b4b16215c6997ba2d292d26e7ee89305d5006a 100644 (file)
@@ -406,6 +406,7 @@ shm_retry:
                        Debug( LDAP_DEBUG_ANY,
                                LDAP_XSTRING(bdb_db_open) ": %s\n",
                                cr->msg, 0, 0 );
+                       ch_free( db );
                        goto fail;
                }
 
@@ -419,6 +420,8 @@ shm_retry:
                                Debug( LDAP_DEBUG_ANY,
                                        LDAP_XSTRING(bdb_db_open) ": %s\n",
                                        cr->msg, 0, 0 );
+                               db->bdi_db->close( db->bdi_db, 0 );
+                               ch_free( db );
                                goto fail;
                        }
                }
@@ -433,6 +436,8 @@ shm_retry:
                                Debug( LDAP_DEBUG_ANY,
                                        LDAP_XSTRING(bdb_db_open) ": %s\n",
                                        cr->msg, 0, 0 );
+                               db->bdi_db->close( db->bdi_db, 0 );
+                               ch_free( db );
                                goto fail;
                        }
                }
@@ -504,6 +509,7 @@ shm_retry:
                                LDAP_XSTRING(bdb_db_open) ": %s\n",
                                cr->msg, 0, 0 );
                        db->bdi_db->close( db->bdi_db, 0 );
+                       ch_free( db );
                        goto fail;
                }