diff options
Diffstat (limited to 'lib/isc/stats.c')
-rw-r--r-- | lib/isc/stats.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/isc/stats.c b/lib/isc/stats.c index 89e34b3780873..03d2a8a7d103d 100644 --- a/lib/isc/stats.c +++ b/lib/isc/stats.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009, 2012, 2014 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2009, 2012, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -169,19 +169,22 @@ isc_stats_detach(isc_stats_t **statsp) { LOCK(&stats->lock); stats->references--; - UNLOCK(&stats->lock); if (stats->references == 0) { isc_mem_put(stats->mctx, stats->copiedcounters, sizeof(isc_stat_t) * stats->ncounters); isc_mem_put(stats->mctx, stats->counters, sizeof(isc_stat_t) * stats->ncounters); + UNLOCK(&stats->lock); DESTROYLOCK(&stats->lock); #ifdef ISC_RWLOCK_USEATOMIC isc_rwlock_destroy(&stats->counterlock); #endif isc_mem_putanddetach(&stats->mctx, stats, sizeof(*stats)); + return; } + + UNLOCK(&stats->lock); } int |