X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Fstats.c;h=4f3bdb0d0af548b15fa2465d16feb1c209dba674;hb=1d8231fc194a56976c5bb14a75ff548ef5440191;hp=6b09e604ec0d969f6bffc18759d4b74f77730273;hpb=474deb0826ebcd7b748e15dd7f0fc6da0f64cd89;p=awesomized%2Flibmemcached diff --git a/libmemcached/stats.c b/libmemcached/stats.c index 6b09e604..4f3bdb0d 100644 --- a/libmemcached/stats.c +++ b/libmemcached/stats.c @@ -371,6 +371,8 @@ memcached_stat_st *memcached_stat(memcached_st *ptr, char *args, memcached_retur stats= ptr->call_calloc(ptr, ptr->number_of_hosts, sizeof(memcached_stat_st)); + stats->root= ptr; + if (!stats) { *error= MEMCACHED_MEMORY_ALLOCATION_FAILURE; @@ -451,8 +453,16 @@ void memcached_stat_free(memcached_st *ptr, memcached_stat_st *memc_stat) return; } - if (ptr) + if (memc_stat->root) + { + memc_stat->root->call_free(ptr, memc_stat); + } + else if (ptr) + { ptr->call_free(ptr, memc_stat); + } else + { free(memc_stat); + } }