summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/mem-pool.c
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs/src/mem-pool.c')
-rw-r--r--libglusterfs/src/mem-pool.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libglusterfs/src/mem-pool.c b/libglusterfs/src/mem-pool.c
index 093592ec056..019be95e37e 100644
--- a/libglusterfs/src/mem-pool.c
+++ b/libglusterfs/src/mem-pool.c
@@ -279,6 +279,10 @@ __gf_free (void *free_ptr)
{
xl->mem_acct.rec[type].size -= req_size;
xl->mem_acct.rec[type].num_allocs--;
+ /* If all the instaces are freed up then ensure typestr is
+ * set to NULL */
+ if (!xl->mem_acct.rec[type].num_allocs)
+ xl->mem_acct.rec[type].typestr = NULL;
}
UNLOCK (&xl->mem_acct.rec[type].lock);
free: