summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
Diffstat (limited to 'xlators')
-rw-r--r--xlators/Makefile.am2
-rw-r--r--xlators/encryption/rot-13/src/rot-13.c16
-rw-r--r--xlators/features/locks/src/common.c80
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c4
-rw-r--r--xlators/protocol/legacy/transport/ib-verbs/src/ib-verbs.c16
5 files changed, 83 insertions, 35 deletions
diff --git a/xlators/Makefile.am b/xlators/Makefile.am
index 495a6829114..4c94f5e44c1 100644
--- a/xlators/Makefile.am
+++ b/xlators/Makefile.am
@@ -1,3 +1,3 @@
SUBDIRS = cluster storage protocol performance debug features encryption mount nfs mgmt
-CLEANFILES =
+CLEANFILES =
diff --git a/xlators/encryption/rot-13/src/rot-13.c b/xlators/encryption/rot-13/src/rot-13.c
index a334b669df0..9d5dab03307 100644
--- a/xlators/encryption/rot-13/src/rot-13.c
+++ b/xlators/encryption/rot-13/src/rot-13.c
@@ -145,9 +145,11 @@ init (xlator_t *this)
gf_log (this->name, GF_LOG_WARNING,
"dangling volume. check volfile ");
}
-
- priv = CALLOC (sizeof (rot_13_private_t), 1);
- ERR_ABORT (priv);
+
+ priv = GF_CALLOC (sizeof (rot_13_private_t), 1, 0);
+ if (!priv)
+ return -1;
+
priv->decrypt_read = 1;
priv->encrypt_write = 1;
@@ -174,13 +176,13 @@ init (xlator_t *this)
return 0;
}
-void
+void
fini (xlator_t *this)
{
rot_13_private_t *priv = this->private;
-
- FREE (priv);
-
+
+ GF_FREE (priv);
+
return;
}
diff --git a/xlators/features/locks/src/common.c b/xlators/features/locks/src/common.c
index 2ba8df002cf..b34cd97813a 100644
--- a/xlators/features/locks/src/common.c
+++ b/xlators/features/locks/src/common.c
@@ -590,70 +590,106 @@ struct _values {
static struct _values
subtract_locks (posix_lock_t *big, posix_lock_t *small)
{
+
struct _values v = { .locks = {0, 0, 0} };
-
- if ((big->fl_start == small->fl_start) &&
- (big->fl_end == small->fl_end)) {
+
+ if ((big->fl_start == small->fl_start) &&
+ (big->fl_end == small->fl_end)) {
/* both edges coincide with big */
v.locks[0] = GF_CALLOC (1, sizeof (posix_lock_t),
gf_locks_mt_posix_lock_t);
- ERR_ABORT (v.locks[0]);
+ if (!v.locks[0])
+ goto out;
memcpy (v.locks[0], big, sizeof (posix_lock_t));
v.locks[0]->fl_type = small->fl_type;
+ goto done;
}
- else if ((small->fl_start > big->fl_start) &&
- (small->fl_end < big->fl_end)) {
+
+ if ((small->fl_start > big->fl_start) &&
+ (small->fl_end < big->fl_end)) {
/* both edges lie inside big */
v.locks[0] = GF_CALLOC (1, sizeof (posix_lock_t),
gf_locks_mt_posix_lock_t);
- ERR_ABORT (v.locks[0]);
+ if (!v.locks[0])
+ goto out;
+
v.locks[1] = GF_CALLOC (1, sizeof (posix_lock_t),
gf_locks_mt_posix_lock_t);
- ERR_ABORT (v.locks[1]);
+ if (!v.locks[1])
+ goto out;
+
v.locks[2] = GF_CALLOC (1, sizeof (posix_lock_t),
gf_locks_mt_posix_lock_t);
- ERR_ABORT (v.locks[2]);
+ if (!v.locks[1])
+ goto out;
memcpy (v.locks[0], big, sizeof (posix_lock_t));
v.locks[0]->fl_end = small->fl_start - 1;
memcpy (v.locks[1], small, sizeof (posix_lock_t));
+
memcpy (v.locks[2], big, sizeof (posix_lock_t));
v.locks[2]->fl_start = small->fl_end + 1;
+ goto done;
+
}
+
/* one edge coincides with big */
- else if (small->fl_start == big->fl_start) {
+ if (small->fl_start == big->fl_start) {
v.locks[0] = GF_CALLOC (1, sizeof (posix_lock_t),
gf_locks_mt_posix_lock_t);
- ERR_ABORT (v.locks[0]);
+ if (!v.locks[0])
+ goto out;
+
v.locks[1] = GF_CALLOC (1, sizeof (posix_lock_t),
gf_locks_mt_posix_lock_t);
- ERR_ABORT (v.locks[1]);
-
+ if (!v.locks[1])
+ goto out;
+
memcpy (v.locks[0], big, sizeof (posix_lock_t));
v.locks[0]->fl_start = small->fl_end + 1;
-
+
memcpy (v.locks[1], small, sizeof (posix_lock_t));
+ goto done;
}
- else if (small->fl_end == big->fl_end) {
+
+ if (small->fl_end == big->fl_end) {
v.locks[0] = GF_CALLOC (1, sizeof (posix_lock_t),
gf_locks_mt_posix_lock_t);
- ERR_ABORT (v.locks[0]);
+ if (!v.locks[0])
+ goto out;
+
v.locks[1] = GF_CALLOC (1, sizeof (posix_lock_t),
gf_locks_mt_posix_lock_t);
- ERR_ABORT (v.locks[1]);
+ if (!v.locks[1])
+ goto out;
memcpy (v.locks[0], big, sizeof (posix_lock_t));
v.locks[0]->fl_end = small->fl_start - 1;
-
+
memcpy (v.locks[1], small, sizeof (posix_lock_t));
+ goto done;
}
- else {
- gf_log ("posix-locks", GF_LOG_ERROR,
- "Unexpected case in subtract_locks. Please send "
- "a bug report to gluster-devel@nongnu.org");
+
+ gf_log ("posix-locks", GF_LOG_ERROR,
+ "Unexpected case in subtract_locks. Please send "
+ "a bug report to gluster-devel@nongnu.org");
+
+out:
+ if (v.locks[0]) {
+ GF_FREE (v.locks[0]);
+ v.locks[0] = NULL;
+ }
+ if (v.locks[1]) {
+ GF_FREE (v.locks[1]);
+ v.locks[1] = NULL;
+ }
+ if (v.locks[2]) {
+ GF_FREE (v.locks[2]);
+ v.locks[2] = NULL;
}
+done:
return v;
}
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index e5df3648033..b1de4692a10 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -2594,7 +2594,8 @@ fuse_xattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
trav = trav->next;
} /* while(trav) */
value = alloca (len + 1);
- ERR_ABORT (value);
+ if (!value)
+ goto out;
len = 0;
trav = dict->members_list;
while (trav) {
@@ -2633,6 +2634,7 @@ fuse_xattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
send_fuse_err (this, finh, op_errno);
} /* if(op_ret>=0)...else */
+out:
if (need_to_free_dict)
dict_unref (dict);
diff --git a/xlators/protocol/legacy/transport/ib-verbs/src/ib-verbs.c b/xlators/protocol/legacy/transport/ib-verbs/src/ib-verbs.c
index 85228bf4e58..0db996405e8 100644
--- a/xlators/protocol/legacy/transport/ib-verbs/src/ib-verbs.c
+++ b/xlators/protocol/legacy/transport/ib-verbs/src/ib-verbs.c
@@ -731,7 +731,8 @@ ib_verbs_register_peer (ib_verbs_device_t *device,
return;
}
ent = (struct _qpent *) GF_CALLOC (1, sizeof (*ent), gf_ibv_mt_qpent);
- ERR_ABORT (ent);
+ if (!ent)
+ return;
/* TODO: ref reg->peer */
ent->peer = peer;
ent->next = &qpreg->ents[hash];
@@ -1522,7 +1523,8 @@ ib_verbs_get_device (transport_t *this,
trav = GF_CALLOC (1, sizeof (*trav),
gf_ibv_mt_ib_verbs_device_t);
- ERR_ABORT (trav);
+ if (!trav)
+ return NULL;
priv->device = trav;
trav->context = ibctx;
@@ -2357,10 +2359,16 @@ ib_verbs_server_event_handler (int fd, int idx, void *data,
this = GF_CALLOC (1, sizeof (transport_t),
gf_ibv_mt_transport_t);
- ERR_ABORT (this);
+ if (!this)
+ return 0;
+
priv = GF_CALLOC (1, sizeof (ib_verbs_private_t),
gf_ibv_mt_ib_verbs_private_t);
- ERR_ABORT (priv);
+ if (!priv) {
+ GF_FREE (this);
+ return 0;
+ }
+
this->private = priv;
/* Copy all the ib_verbs related values in priv, from trans_priv
as other than QP, all the values remain same */