From 1f42bdc61dff4fbbb27724134732bc0d931edda5 Mon Sep 17 00:00:00 2001 From: Thomas Hindoe Paaboel Andersen Date: Sat, 16 Jun 2018 08:24:00 +0200 Subject: cloudsync: avoid null pointer deref in error paths In the case of OOM we would end up dereferencing priv in the out label of aws_init(). A similar deref would happen if a null priv is passed to aws_reconfigure(). Change-Id: I57c80aad2b52ecb1eda86a0077ed6b46816e5dea fixes: bz#1592141 Signed-off-by: Thomas Hindoe Paaboel Andersen --- .../src/cloudsync-plugins/src/cloudsyncs3/src/libcloudsyncs3.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'xlators/features') diff --git a/xlators/features/cloudsync/src/cloudsync-plugins/src/cloudsyncs3/src/libcloudsyncs3.c b/xlators/features/cloudsync/src/cloudsync-plugins/src/cloudsyncs3/src/libcloudsyncs3.c index 019f98017dc..74e50871472 100644 --- a/xlators/features/cloudsync/src/cloudsync-plugins/src/cloudsyncs3/src/libcloudsyncs3.c +++ b/xlators/features/cloudsync/src/cloudsync-plugins/src/cloudsyncs3/src/libcloudsyncs3.c @@ -49,8 +49,7 @@ aws_init (xlator_t *this) gf_libaws_mt_aws_private_t); if (!priv) { gf_msg (this->name, GF_LOG_ERROR, 0, 0, "insufficient memory"); - ret = -1; - goto out; + return NULL; } priv->abortdl = _gf_false; @@ -113,7 +112,6 @@ aws_init (xlator_t *this) unlock: pthread_spin_unlock (&(priv->lock)); -out: if (ret == -1) { GF_FREE (priv->awskeyid); GF_FREE (priv->awssekey); @@ -140,8 +138,7 @@ aws_reconfigure (xlator_t *this, dict_t *options) if (!priv) { gf_msg (this->name, GF_LOG_ERROR, 0, 0, "null priv"); - ret = -1; - goto out; + return -1; } pthread_spin_lock (&(priv->lock)); -- cgit