X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libraries%2Flibldap_r%2Ftpool.c;h=cb95e7df49c78c7a08667919b2ae0fa8c06374ce;hb=7eda0c2e442bbf39d323200541152a843972efbb;hp=87e959449134e27655421229d308455db581e0b8;hpb=6f6ee3eada75d0ea8bee306c7953417f601c5bb8;p=openldap diff --git a/libraries/libldap_r/tpool.c b/libraries/libldap_r/tpool.c index 87e9594491..cb95e7df49 100644 --- a/libraries/libldap_r/tpool.c +++ b/libraries/libldap_r/tpool.c @@ -1,7 +1,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 1998-2013 The OpenLDAP Foundation. + * Copyright 1998-2015 The OpenLDAP Foundation. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -214,14 +214,22 @@ ldap_pvt_thread_pool_init ( if (pool == NULL) return(-1); rc = ldap_pvt_thread_mutex_init(&pool->ltp_mutex); - if (rc != 0) + if (rc != 0) { +fail1: + LDAP_FREE(pool); return(rc); + } rc = ldap_pvt_thread_cond_init(&pool->ltp_cond); - if (rc != 0) - return(rc); + if (rc != 0) { +fail2: + ldap_pvt_thread_mutex_destroy(&pool->ltp_mutex); + goto fail1; + } rc = ldap_pvt_thread_cond_init(&pool->ltp_pcond); - if (rc != 0) - return(rc); + if (rc != 0) { + ldap_pvt_thread_cond_destroy(&pool->ltp_cond); + goto fail2; + } ldap_int_has_thread_pool = 1;