]> git.sur5r.net Git - openldap/commitdiff
Plug one-time leaks
authorHoward Chu <hyc@openldap.org>
Wed, 4 Jun 2014 09:23:18 +0000 (02:23 -0700)
committerHoward Chu <hyc@openldap.org>
Wed, 4 Jun 2014 09:23:18 +0000 (02:23 -0700)
libraries/libldap_r/tpool.c
servers/slapd/bconfig.c

index dea3985f9e56b575ea7b3f210e49cbfde595405e..44f9544b58e68c27aa015b1f7e195205bee386fb 100644 (file)
@@ -826,6 +826,13 @@ ldap_pvt_thread_pool_destroy ( ldap_pvt_thread_pool_t *tpool, int run_pending )
        ldap_pvt_thread_cond_destroy(&pool->ltp_pcond);
        ldap_pvt_thread_cond_destroy(&pool->ltp_cond);
        ldap_pvt_thread_mutex_destroy(&pool->ltp_mutex);
+       for (i=0; i<pool->ltp_numqs; i++) {
+               pq = pool->ltp_wqs[i];
+               if (pq->ltp_free) {
+                       LDAP_FREE(pq->ltp_free);
+               }
+       }
+       LDAP_FREE(pool->ltp_wqs);
        LDAP_FREE(pool);
        *tpool = NULL;
        ldap_int_has_thread_pool = 0;
@@ -976,6 +983,7 @@ ldap_int_thread_pool_wrapper (
                ldap_pvt_thread_cond_destroy(&pq->ltp_cond);
                ldap_pvt_thread_mutex_destroy(&pq->ltp_mutex);
                LDAP_FREE(pq->ltp_free);
+               pq->ltp_free = NULL;
        }
        ldap_pvt_thread_exit(NULL);
        return(NULL);
index 9d49d2b21ba1688b9d45d006b5aa8cf93e23ca2e..beef2edaf5e038ad8fe8fea85cfd539b23432952 100644 (file)
@@ -3661,7 +3661,8 @@ loglevel2bvarray( int l, BerVarray *bva )
        }
 
        if ( l == 0 ) {
-               return value_add_one( bva, ber_bvstr( "0" ) );
+               struct berval bv = BER_BVC("0");
+               return value_add_one( bva, &bv );
        }
 
        return mask_to_verbs( loglevel_ops, l, bva );