diff options
Diffstat (limited to 'rpc')
-rw-r--r-- | rpc/rpc-lib/src/rpc-clnt.c | 2 | ||||
-rw-r--r-- | rpc/rpc-transport/socket/src/socket.c | 2 | ||||
-rw-r--r-- | rpc/xdr/src/glusterfs3.h | 8 |
3 files changed, 7 insertions, 5 deletions
diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c index a4663648a38..9ee9161c904 100644 --- a/rpc/rpc-lib/src/rpc-clnt.c +++ b/rpc/rpc-lib/src/rpc-clnt.c @@ -1592,7 +1592,7 @@ rpcclnt_cbk_program_register (struct rpc_clnt *clnt, goto out; } - tmp = GF_CALLOC (1, sizeof (*tmp), + tmp = GF_MALLOC (sizeof (*tmp), gf_common_mt_rpcclnt_cb_program_t); if (tmp == NULL) { goto out; diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c index 9518bb9d9df..ff9423f1059 100644 --- a/rpc/rpc-transport/socket/src/socket.c +++ b/rpc/rpc-transport/socket/src/socket.c @@ -4522,7 +4522,7 @@ socket_init (rpc_transport_t *this) return -1; } - priv = GF_CALLOC (1, sizeof (*priv), gf_common_mt_socket_private_t); + priv = GF_MALLOC (sizeof (*priv), gf_common_mt_socket_private_t); if (!priv) { return -1; } diff --git a/rpc/xdr/src/glusterfs3.h b/rpc/xdr/src/glusterfs3.h index 7afa6dcf0ee..4ffad3c5b45 100644 --- a/rpc/xdr/src/glusterfs3.h +++ b/rpc/xdr/src/glusterfs3.h @@ -812,7 +812,7 @@ xdr_to_dict (gfx_dict *dict, dict_t **to) xpair->value.gfx_value_u.value_dbl); break; case GF_DATA_TYPE_STR: - value = GF_CALLOC (1, xpair->value.gfx_value_u.val_string.val_string_len + 1, + value = GF_MALLOC (xpair->value.gfx_value_u.val_string.val_string_len + 1, gf_common_mt_char); if (!value) { errno = ENOMEM; @@ -820,11 +820,12 @@ xdr_to_dict (gfx_dict *dict, dict_t **to) } memcpy (value, xpair->value.gfx_value_u.val_string.val_string_val, xpair->value.gfx_value_u.val_string.val_string_len); + value[xpair->value.gfx_value_u.val_string.val_string_len] = '\0'; free (xpair->value.gfx_value_u.val_string.val_string_val); ret = dict_set_dynstr (this, key, value); break; case GF_DATA_TYPE_GFUUID: - uuid = GF_CALLOC (1, sizeof (uuid_t), gf_common_mt_uuid_t); + uuid = GF_MALLOC (sizeof (uuid_t), gf_common_mt_uuid_t); if (!uuid) { errno = ENOMEM; goto out; @@ -842,7 +843,7 @@ xdr_to_dict (gfx_dict *dict, dict_t **to) ret = dict_set_iatt (this, key, iatt, false); break; case GF_DATA_TYPE_PTR: - value = GF_CALLOC (1, xpair->value.gfx_value_u.other.other_len + 1, + value = GF_MALLOC (xpair->value.gfx_value_u.other.other_len + 1, gf_common_mt_char); if (!value) { errno = ENOMEM; @@ -850,6 +851,7 @@ xdr_to_dict (gfx_dict *dict, dict_t **to) } memcpy (value, xpair->value.gfx_value_u.other.other_val, xpair->value.gfx_value_u.other.other_len); + value[xpair->value.gfx_value_u.other.other_len] = '\0'; free (xpair->value.gfx_value_u.other.other_val); ret = dict_set_dynptr (this, key, value, xpair->value.gfx_value_u.other.other_len); |