/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1998-2013 The OpenLDAP Foundation.
+ * Copyright 1998-2016 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
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;