diff options
| author | Harshavardhana Ranganath <harsha@gluster.com> | 2009-12-17 15:43:34 +0000 | 
|---|---|---|
| committer | Anand V. Avati <avati@dev.gluster.com> | 2010-01-23 01:56:53 -0800 | 
| commit | 5f73c75c60841d8173f896b80432286c6458d853 (patch) | |
| tree | eef96128324934b70cc59c5b3f76d41ad7a1cd44 | |
| parent | dc7448e508fdba87d161be7695a2c449f2cb573d (diff) | |
Add null pointer checks in "fini"
Signed-off-by: Harshavardhana <harsha@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 364 (Segfault in io-cache)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=364
| -rw-r--r-- | xlators/cluster/stripe/src/stripe.c | 7 | ||||
| -rw-r--r-- | xlators/performance/io-cache/src/io-cache.c | 3 | ||||
| -rw-r--r-- | xlators/performance/read-ahead/src/read-ahead.c | 3 | 
3 files changed, 12 insertions, 1 deletions
diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c index a29409a03f2..197bc50f456 100644 --- a/xlators/cluster/stripe/src/stripe.c +++ b/xlators/cluster/stripe/src/stripe.c @@ -3241,7 +3241,12 @@ fini (xlator_t *this)  {  	stripe_private_t *priv = this->private;  	struct stripe_options *prev = NULL; -	struct stripe_options *trav = priv->pattern; +	struct stripe_options *trav = NULL; + +        if (priv == NULL) +                return; + +        trav = priv->pattern;  	while (trav) {  		prev = trav;  		trav = trav->next; diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c index ba170c3380e..c3f76b3bde1 100644 --- a/xlators/performance/io-cache/src/io-cache.c +++ b/xlators/performance/io-cache/src/io-cache.c @@ -1198,6 +1198,9 @@ fini (xlator_t *this)  {  	ioc_table_t *table = this->private; +        if (table == NULL) +                return; +  	pthread_mutex_destroy (&table->table_lock);  	FREE (table); diff --git a/xlators/performance/read-ahead/src/read-ahead.c b/xlators/performance/read-ahead/src/read-ahead.c index e508a99a37e..1b37cace330 100644 --- a/xlators/performance/read-ahead/src/read-ahead.c +++ b/xlators/performance/read-ahead/src/read-ahead.c @@ -852,6 +852,9 @@ fini (xlator_t *this)  {  	ra_conf_t *conf = this->private; +        if (conf == NULL) +                return; +  	pthread_mutex_destroy (&conf->conf_lock);  	FREE (conf);  | 
