diff options
author | Atin Mukherjee <amukherj@redhat.com> | 2016-05-31 16:44:48 +0530 |
---|---|---|
committer | Jeff Darcy <jdarcy@redhat.com> | 2016-08-04 08:44:09 -0700 |
commit | 049c91565dddb622b8902ccfeb36c0d414c609e1 (patch) | |
tree | 850d2869b552b299381f2ef1cdf1f8dea89bbdad /libglusterfs/src/mem-pool.c | |
parent | e4a404342cc1b53b1f16b68938f31d2b12dc9121 (diff) |
libglusterfs: fix glusterd statedump crash
commit 3c04a91 removed setting typeStr to NULL if num_allocs is set to 0, this
has caused this regression. Code has been put back like earlier and to avoid
statedump printing all the NULL values check is modified to see skip the records
if num_allocs is 0 instead of total_allocs
Change-Id: Ib8bcc2fba908e88cf52b641c3f6bcba74f5e667c
BUG: 1359190
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-on: http://review.gluster.org/14987
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Smoke: Gluster Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: N Balachandran <nbalacha@redhat.com>
Reviewed-by: Prashanth Pai <ppai@redhat.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'libglusterfs/src/mem-pool.c')
-rw-r--r-- | libglusterfs/src/mem-pool.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libglusterfs/src/mem-pool.c b/libglusterfs/src/mem-pool.c index 9533a733959..93a1415a75a 100644 --- a/libglusterfs/src/mem-pool.c +++ b/libglusterfs/src/mem-pool.c @@ -318,6 +318,10 @@ __gf_free (void *free_ptr) { mem_acct->rec[header->type].size -= header->size; mem_acct->rec[header->type].num_allocs--; + /* If all the instances are freed up then ensure typestr is set + * to NULL */ + if (!mem_acct->rec[header->type].num_allocs) + mem_acct->rec[header->type].typestr = NULL; } UNLOCK (&mem_acct->rec[header->type].lock); |