aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds-registry
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/mds-registry/reexec.c6
-rw-r--r--src/mds-registry/registry.c10
-rw-r--r--src/mds-registry/slave.c12
3 files changed, 14 insertions, 14 deletions
diff --git a/src/mds-registry/reexec.c b/src/mds-registry/reexec.c
index 6f6510e..f1e458c 100644
--- a/src/mds-registry/reexec.c
+++ b/src/mds-registry/reexec.c
@@ -157,11 +157,11 @@ int unmarshal_server(char* state_buf)
for (i = 0; i < n; i++)
{
stage = 1;
- fail_if ((command = strdup(state_buf)) == NULL);
+ fail_if (xstrdup(command, state_buf));
state_buf += strlen(command) + 1;
stage = 2;
- fail_if ((list = malloc(sizeof(client_list_t))) == NULL);
+ fail_if (xmalloc(list, 1, client_list_t));
buf_get_next(state_buf, size_t, m);
stage = 3;
fail_if (client_list_unmarshal(list, state_buf));
@@ -183,7 +183,7 @@ int unmarshal_server(char* state_buf)
foreach_linked_list_node (slave_list, node)
{
stage = 5;
- fail_if ((slave = malloc(sizeof(slave_t))) == NULL);
+ fail_if (xmalloc(slave, 1, slave_t));
stage = 6;
fail_if ((n = slave_unmarshal(slave, state_buf)) == 0);
state_buf += n / sizeof(char);
diff --git a/src/mds-registry/registry.c b/src/mds-registry/registry.c
index f853f93..b13c7b4 100644
--- a/src/mds-registry/registry.c
+++ b/src/mds-registry/registry.c
@@ -139,11 +139,11 @@ static int registry_action_add(int has_key, char* command, size_t command_key, u
/* If the protocol is not already in the table. */
/* Allocate list of servers for the protocol. */
- client_list_t* list = malloc(sizeof(client_list_t));
- void* address = list;
- fail_if (list == NULL);
+ client_list_t* list;
+ void* address;
+ fail_if (xmalloc(address = list, 1, client_list_t));
/* Duplicate the protocol name so it can be accessed later. */
- if ((command = strdup(command)) == NULL)
+ if (xstrdup(command, command))
{
saved_errno = errno, free(list), errno = saved_errno;
fail_if (1);
@@ -227,7 +227,7 @@ static int registry_action_act(char* command, int action, uint64_t client, hash_
else if ((action == 0) && !has_key)
{
/* Add protocol to wait set of not present in the protocol table. */
- fail_if ((command = strdup(command)) == NULL);
+ fail_if (xstrdup(command, command));
command_key = (size_t)(void*)command;
if (hash_table_put(wait_set, command_key, 1) == 0)
if (errno)
diff --git a/src/mds-registry/slave.c b/src/mds-registry/slave.c
index ef46963..5e496f5 100644
--- a/src/mds-registry/slave.c
+++ b/src/mds-registry/slave.c
@@ -283,8 +283,8 @@ slave_t* slave_create(hash_table_t* restrict wait_set, const char* restrict recv
rc->wait_set = wait_set;
rc->client = parse_client_id(recv_client_id);
- fail_if ((rc->client_id = strdup(recv_client_id)) == NULL);
- fail_if ((rc->message_id = strdup(recv_message_id)) == NULL);
+ fail_if (xstrdup(rc->client_id, recv_client_id));
+ fail_if (xstrdup(rc->message_id, recv_message_id));
return rc;
@@ -432,16 +432,16 @@ size_t slave_unmarshal(slave_t* restrict this, char* restrict data)
buf_get_next(data, long, this->dethklok.tv_nsec);
n = (strlen((char*)data) + 1) * sizeof(char);
- fail_if ((this->client_id = malloc(n)) == NULL);
+ fail_if (xbmalloc(this->client_id, n));
memcpy(this->client_id, data, n);
data += n, rc += n;
n = (strlen((char*)data) + 1) * sizeof(char);
- fail_if ((this->message_id = malloc(n)) == NULL);
+ fail_if (xbmalloc(this->message_id, n));
memcpy(this->message_id, data, n);
data += n, rc += n;
- fail_if ((this->wait_set = malloc(sizeof(hash_table_t))) == NULL);
+ fail_if (xmalloc(this->wait_set, 1, hash_table_t));
fail_if (hash_table_create(this->wait_set));
buf_get_next(data, size_t, m);
@@ -449,7 +449,7 @@ size_t slave_unmarshal(slave_t* restrict this, char* restrict data)
while (m--)
{
n = (strlen((char*)data) + 1) * sizeof(char);
- fail_if ((protocol = malloc(n)) == NULL);
+ fail_if (xbmalloc(protocol, n));
memcpy(protocol, data, n);
data += n, rc += n;