summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--glusterfsd/src/glusterfsd.c6
-rw-r--r--libglusterfs/src/common-utils.c2
-rw-r--r--libglusterfs/src/event.c5
-rw-r--r--libglusterfs/src/logging.c5
-rw-r--r--libglusterfs/src/xlator.c3
-rw-r--r--rpc/rpc-transport/socket/src/socket.c3
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-sm.c6
-rw-r--r--xlators/performance/write-behind/src/write-behind.c10
-rw-r--r--xlators/protocol/client/src/client3_1-fops.c2
-rw-r--r--xlators/protocol/legacy/server/src/server-protocol.c3
-rw-r--r--xlators/protocol/server/src/server-handshake.c3
-rw-r--r--xlators/protocol/server/src/server-helpers.c3
-rw-r--r--xlators/protocol/server/src/server-resolve.c4
-rw-r--r--xlators/storage/posix/src/posix.c2
14 files changed, 47 insertions, 10 deletions
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c
index 30057b5db..7fd447880 100644
--- a/glusterfsd/src/glusterfsd.c
+++ b/glusterfsd/src/glusterfsd.c
@@ -315,6 +315,9 @@ gf_remember_xlator_option (struct list_head *options, char *arg)
option = GF_CALLOC (1, sizeof (xlator_cmdline_option_t),
gfd_mt_xlator_cmdline_option_t);
+ if (!option)
+ goto out;
+
INIT_LIST_HEAD (&option->cmd_args);
dot = strchr (arg, '.');
@@ -331,6 +334,9 @@ gf_remember_xlator_option (struct list_head *options, char *arg)
option->key = GF_CALLOC ((equals - dot) + 1, sizeof (char),
gfd_mt_char);
+ if (!option->key)
+ goto out;
+
strncpy (option->key, dot + 1, (equals - dot - 1));
if (!*(equals + 1))
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index 1be1f8126..1077f6100 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -90,6 +90,8 @@ gf_resolve_ip6 (const char *hostname,
if (!*dnscache) {
*dnscache = GF_CALLOC (1, sizeof (struct dnscache6),
gf_common_mt_dnscache6);
+ if (!*dnscache)
+ return -1;
}
cache = *dnscache;
diff --git a/libglusterfs/src/event.c b/libglusterfs/src/event.c
index 3243e7f23..59b1bd79e 100644
--- a/libglusterfs/src/event.c
+++ b/libglusterfs/src/event.c
@@ -195,6 +195,8 @@ event_register_poll (struct event_pool *event_pool, int fd,
event_pool->reg = GF_REALLOC (event_pool->reg,
event_pool->count *
sizeof (*event_pool->reg));
+ if (!event_pool->reg)
+ goto unlock;
}
idx = event_pool->used++;
@@ -239,6 +241,7 @@ event_register_poll (struct event_pool *event_pool, int fd,
event_pool->changed = 1;
}
+unlock:
pthread_mutex_unlock (&event_pool->mutex);
return idx;
@@ -402,6 +405,8 @@ event_dispatch_poll_resize (struct event_pool *event_pool,
ufds = GF_CALLOC (sizeof (struct pollfd),
event_pool->evcache_size,
gf_common_mt_pollfd);
+ if (!ufds)
+ goto unlock;
event_pool->evcache = ufds;
}
diff --git a/libglusterfs/src/logging.c b/libglusterfs/src/logging.c
index d5a38e6b6..000c2ccd3 100644
--- a/libglusterfs/src/logging.c
+++ b/libglusterfs/src/logging.c
@@ -311,6 +311,9 @@ __logfile_for_client (char *identifier)
if (!client_logs) {
client = GF_CALLOC (1, sizeof (*client),
gf_common_mt_client_log);
+ if (!client)
+ return NULL;
+
client_log_init (client, identifier);
client_logs = client;
@@ -324,6 +327,8 @@ __logfile_for_client (char *identifier)
if (!client) {
client = GF_CALLOC (1, sizeof (*client),
gf_common_mt_client_log);
+ if (!client)
+ return NULL;
client_log_init (client, identifier);
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c
index c2f585d03..e5b97f7c4 100644
--- a/libglusterfs/src/xlator.c
+++ b/libglusterfs/src/xlator.c
@@ -749,6 +749,9 @@ xlator_set_type (xlator_t *xl,
vol_opt = GF_CALLOC (1, sizeof (volume_opt_list_t),
gf_common_mt_volume_opt_list_t);
+ if (!vol_opt)
+ return -1;
+
if (!(vol_opt->given_opt = dlsym (handle, "options"))) {
dlerror ();
gf_log (xl->name, GF_LOG_DEBUG,
diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c
index 6406d4589..4396454a3 100644
--- a/rpc/rpc-transport/socket/src/socket.c
+++ b/rpc/rpc-transport/socket/src/socket.c
@@ -1503,6 +1503,9 @@ socket_server_event_handler (int fd, int idx, void *data,
new_trans = GF_CALLOC (1, sizeof (*new_trans),
gf_common_mt_rpc_trans_t);
+ if (!new_trans)
+ goto unlock;
+
new_trans->fini = this->fini;
new_trans->name = gf_strdup (this->name);
diff --git a/xlators/mgmt/glusterd/src/glusterd-sm.c b/xlators/mgmt/glusterd/src/glusterd-sm.c
index b1a4c0d8a..1ac3f902b 100644
--- a/xlators/mgmt/glusterd/src/glusterd-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-sm.c
@@ -550,6 +550,8 @@ glusterd_friend_sm ()
event->peerinfo = peerinfo;
}
+ if (!peerinfo)
+ goto out;
state = glusterd_friend_state_table[peerinfo->state.state];
@@ -573,7 +575,7 @@ glusterd_friend_sm ()
gf_log ("glusterd", GF_LOG_ERROR, "Unable to transition"
"state from %d to %d", peerinfo->state.state,
state[event_type].next_state);
- return ret;
+ goto out;
}
GF_FREE (event);
@@ -582,7 +584,7 @@ glusterd_friend_sm ()
ret = 0;
-
+out:
return ret;
}
diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c
index 4095527d8..d3f24a590 100644
--- a/xlators/performance/write-behind/src/write-behind.c
+++ b/xlators/performance/write-behind/src/write-behind.c
@@ -564,6 +564,7 @@ out:
}
GF_FREE (local);
+ local = NULL;
}
if (iobref != NULL) {
@@ -579,10 +580,11 @@ out:
* had we winded these requests, we would have unrefed
* in wb_sync_cbk.
*/
-
- list_for_each_entry_safe (request, dummy, &local->winds,
- winds) {
- wb_request_unref (request);
+ if (local) {
+ list_for_each_entry_safe (request, dummy, &local->winds,
+ winds) {
+ wb_request_unref (request);
+ }
}
if (file != NULL) {
diff --git a/xlators/protocol/client/src/client3_1-fops.c b/xlators/protocol/client/src/client3_1-fops.c
index 06b333484..a007803b7 100644
--- a/xlators/protocol/client/src/client3_1-fops.c
+++ b/xlators/protocol/client/src/client3_1-fops.c
@@ -2080,7 +2080,7 @@ out:
GF_FREE (fdctx);
}
- if (ret)
+ if (ret && fr)
STACK_DESTROY (fr->root);
return ret;
diff --git a/xlators/protocol/legacy/server/src/server-protocol.c b/xlators/protocol/legacy/server/src/server-protocol.c
index 839c6a557..e6c668d15 100644
--- a/xlators/protocol/legacy/server/src/server-protocol.c
+++ b/xlators/protocol/legacy/server/src/server-protocol.c
@@ -4914,7 +4914,8 @@ _volfile_update_checksum (xlator_t *this, char *key, uint32_t checksum)
if (!temp_volfile) {
temp_volfile = GF_CALLOC (1, sizeof (struct _volfile_ctx),
gf_server_mt_volfile_ctx);
-
+ if (!temp_volfile)
+ goto out;
temp_volfile->next = conf->volfile;
temp_volfile->key = (key)? gf_strdup (key): NULL;
temp_volfile->checksum = checksum;
diff --git a/xlators/protocol/server/src/server-handshake.c b/xlators/protocol/server/src/server-handshake.c
index d386e9ce5..f9a4bca36 100644
--- a/xlators/protocol/server/src/server-handshake.c
+++ b/xlators/protocol/server/src/server-handshake.c
@@ -91,7 +91,8 @@ _volfile_update_checksum (xlator_t *this, char *key, uint32_t checksum)
if (!temp_volfile) {
temp_volfile = GF_CALLOC (1, sizeof (struct _volfile_ctx),
gf_server_mt_volfile_ctx_t);
-
+ if (!temp_volfile)
+ goto out;
temp_volfile->next = conf->volfile;
temp_volfile->key = (key)? gf_strdup (key): NULL;
temp_volfile->checksum = checksum;
diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c
index 37418ac1d..84c66d114 100644
--- a/xlators/protocol/server/src/server-helpers.c
+++ b/xlators/protocol/server/src/server-helpers.c
@@ -684,6 +684,8 @@ server_connection_get (xlator_t *this, const char *id)
if (!conn) {
conn = (void *) GF_CALLOC (1, sizeof (*conn),
gf_server_mt_conn_t);
+ if (!conn)
+ goto unlock;
conn->id = gf_strdup (id);
conn->fdtable = gf_fd_fdtable_alloc ();
@@ -697,6 +699,7 @@ server_connection_get (xlator_t *this, const char *id)
conn->ref++;
conn->active_transports++;
}
+unlock:
pthread_mutex_unlock (&conf->mutex);
return conn;
diff --git a/xlators/protocol/server/src/server-resolve.c b/xlators/protocol/server/src/server-resolve.c
index 77336216f..91cf0d96f 100644
--- a/xlators/protocol/server/src/server-resolve.c
+++ b/xlators/protocol/server/src/server-resolve.c
@@ -75,6 +75,8 @@ prepare_components (call_frame_t *frame)
count = component_count (resolve->path);
components = GF_CALLOC (sizeof (*components), count,
gf_server_mt_resolv_comp_t);
+ if (!components)
+ goto out;
resolve->components = components;
components[0].basename = "";
@@ -90,7 +92,7 @@ prepare_components (call_frame_t *frame)
i++;
}
}
-
+out:
return 0;
}
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index 2810bbd6a..da5156709 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -179,6 +179,8 @@ _posix_xattr_get_set (dict_t *xattr_req,
if (xattr_size > 0) {
value = GF_CALLOC (1, xattr_size + 1,
gf_posix_mt_char);
+ if (!value)
+ return;
sys_lgetxattr (filler->real_path, key, value,
xattr_size);