summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr
diff options
context:
space:
mode:
authorTiziano Müller <tiziano.mueller@stepping-stone.ch>2014-09-27 18:23:24 +0200
committerNiels de Vos <ndevos@redhat.com>2014-10-07 00:42:29 -0700
commit673b1deced72f9325caf0b5d6fb160ad17ec4b35 (patch)
tree003148904234971f6b011b23bf1f91c74a6d5482 /xlators/cluster/afr
parentdb7d578da03a5d8bbc2169a45baea5e0e3ddc1e3 (diff)
Only cleanup priv->shd.statistics if created
It is possible that the statistics array was never created and dereferencing it may case a segfault. BUG: 1147156 Change-Id: If905457ba985add62c3ed543bced1313640af762 Signed-off-by: Tiziano Müller <tiziano.mueller@stepping-stone.ch> Reviewed-on: http://review.gluster.org/8873 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
Diffstat (limited to 'xlators/cluster/afr')
-rw-r--r--xlators/cluster/afr/src/afr-common.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index 6fd3e321930..5e52588a1f3 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -4769,13 +4769,16 @@ afr_priv_destroy (afr_private_t *priv)
if (priv->shd.split_brain)
eh_destroy (priv->shd.split_brain);
- for (i = 0; i < priv->child_count; i++)
+ if (priv->shd.statistics)
{
- if (priv->shd.statistics[i])
- eh_destroy (priv->shd.statistics[i]);
- }
+ for (i = 0; i < priv->child_count; i++)
+ {
+ if (priv->shd.statistics[i])
+ eh_destroy (priv->shd.statistics[i]);
+ }
- GF_FREE (priv->shd.statistics);
+ GF_FREE (priv->shd.statistics);
+ }
GF_FREE (priv->shd.crawl_events);