summaryrefslogtreecommitdiffstats
path: root/xlators/features/cloudsync/src
diff options
context:
space:
mode:
authorThomas Hindoe Paaboel Andersen <phomes@gmail.com>2018-06-16 08:24:00 +0200
committerAmar Tumballi <amarts@redhat.com>2018-06-25 09:11:48 +0000
commit1f42bdc61dff4fbbb27724134732bc0d931edda5 (patch)
treeea4c3df7ab74462bc3f3ec9d4dfe2f4a121c18f5 /xlators/features/cloudsync/src
parent1ced279c2e8ea0b4d1290da629e05c480a18f888 (diff)
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 <phomes@gmail.com>
Diffstat (limited to 'xlators/features/cloudsync/src')
-rw-r--r--xlators/features/cloudsync/src/cloudsync-plugins/src/cloudsyncs3/src/libcloudsyncs3.c7
1 files changed, 2 insertions, 5 deletions
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));