summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libglusterfs/src/dict.c1
-rw-r--r--libglusterfs/src/glusterfs/dict.h1
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handshake.c7
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-svc-helper.c3
-rw-r--r--xlators/protocol/client/src/client-helpers.c15
-rw-r--r--xlators/protocol/server/src/server-handshake.c21
6 files changed, 14 insertions, 34 deletions
diff --git a/libglusterfs/src/dict.c b/libglusterfs/src/dict.c
index 2682e6a..ddd27eb 100644
--- a/libglusterfs/src/dict.c
+++ b/libglusterfs/src/dict.c
@@ -705,7 +705,6 @@ dict_destroy(dict_t *this)
mem_put(this->members);
}
- GF_FREE(this->extra_free);
free(this->extra_stdfree);
/* update 'ctx->stats.dict.details' using max_count */
diff --git a/libglusterfs/src/glusterfs/dict.h b/libglusterfs/src/glusterfs/dict.h
index 8fc4b7e..ce1c210 100644
--- a/libglusterfs/src/glusterfs/dict.h
+++ b/libglusterfs/src/glusterfs/dict.h
@@ -118,7 +118,6 @@ struct _dict {
gf_atomic_t refcount;
data_pair_t **members;
data_pair_t *members_list;
- char *extra_free;
char *extra_stdfree;
gf_lock_t lock;
data_pair_t *members_internal;
diff --git a/xlators/mgmt/glusterd/src/glusterd-handshake.c b/xlators/mgmt/glusterd/src/glusterd-handshake.c
index 1cbdc30..7cb70fc 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handshake.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handshake.c
@@ -1052,11 +1052,9 @@ __server_getspec(rpcsvc_request_t *req)
if (ret) {
gf_msg(this->name, GF_LOG_ERROR, 0,
GD_MSG_DICT_SERL_LENGTH_GET_FAIL,
- "Failed to serialize dict "
- "to request buffer");
+ "Failed to serialize dict to request buffer");
goto fail;
}
- dict->extra_free = rsp.xdata.xdata_val;
}
/* to allocate the proper buffer to hold the file data */
@@ -1131,6 +1129,9 @@ fail:
if (args.xdata.xdata_val)
free(args.xdata.xdata_val);
+ if (rsp.xdata.xdata_val)
+ GF_FREE(rsp.xdata.xdata_val);
+
return 0;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-svc-helper.c b/xlators/mgmt/glusterd/src/glusterd-svc-helper.c
index a27838b..d267df1 100644
--- a/xlators/mgmt/glusterd/src/glusterd-svc-helper.c
+++ b/xlators/mgmt/glusterd/src/glusterd-svc-helper.c
@@ -838,7 +838,6 @@ __glusterd_send_svc_configure_req(glusterd_svc_t *svc, int flags,
"to request buffer");
goto *errlbl;
}
- dict->extra_free = brick_req.dict.dict_val;
}
frame->cookie = svc;
@@ -900,6 +899,8 @@ maybe_free_iobuf:
err:
if (dict)
dict_unref(dict);
+ if (brick_req.dict.dict_val)
+ GF_FREE(brick_req.dict.dict_val);
GF_FREE(volfile_content);
if (spec_fd >= 0)
diff --git a/xlators/protocol/client/src/client-helpers.c b/xlators/protocol/client/src/client-helpers.c
index 156f1cd..e49647f 100644
--- a/xlators/protocol/client/src/client-helpers.c
+++ b/xlators/protocol/client/src/client-helpers.c
@@ -175,7 +175,6 @@ unserialize_rsp_direntp(xlator_t *this, fd_t *fd, struct gfs3_readdirp_rsp *rsp,
gf_dirent_t *entries)
{
struct gfs3_dirplist *trav = NULL;
- char *buf = NULL;
gf_dirent_t *entry = NULL;
inode_table_t *itable = NULL;
int entry_len = 0;
@@ -207,22 +206,18 @@ unserialize_rsp_direntp(xlator_t *this, fd_t *fd, struct gfs3_readdirp_rsp *rsp,
strcpy(entry->d_name, trav->name);
if (trav->dict.dict_val) {
- /* Dictionary is sent along with response */
- buf = gf_memdup(trav->dict.dict_val, trav->dict.dict_len);
- if (!buf)
- goto out;
-
entry->dict = dict_new();
+ if (!entry->dict)
+ goto out;
- ret = dict_unserialize(buf, trav->dict.dict_len, &entry->dict);
+ ret = dict_unserialize(trav->dict.dict_val, trav->dict.dict_len,
+ &entry->dict);
if (ret < 0) {
gf_msg(THIS->name, GF_LOG_WARNING, EINVAL,
PC_MSG_DICT_UNSERIALIZE_FAIL,
"failed to unserialize xattr dict");
goto out;
}
- GF_FREE(buf);
- buf = NULL;
}
entry->inode = inode_find(itable, entry->d_stat.ia_gfid);
@@ -237,8 +232,6 @@ unserialize_rsp_direntp(xlator_t *this, fd_t *fd, struct gfs3_readdirp_rsp *rsp,
ret = 0;
out:
- if (buf)
- GF_FREE(buf);
if (entry)
gf_dirent_entry_free(entry);
return ret;
diff --git a/xlators/protocol/server/src/server-handshake.c b/xlators/protocol/server/src/server-handshake.c
index dda58b6..6e584a7 100644
--- a/xlators/protocol/server/src/server-handshake.c
+++ b/xlators/protocol/server/src/server-handshake.c
@@ -240,7 +240,6 @@ server_setvolume(rpcsvc_request_t *req)
int32_t ret = -1;
int32_t op_ret = -1;
int32_t op_errno = EINVAL;
- char *buf = NULL;
uint32_t opversion = 0;
rpc_transport_t *xprt = NULL;
int32_t fop_version = 0;
@@ -267,18 +266,11 @@ server_setvolume(rpcsvc_request_t *req)
*/
config_params = dict_copy_with_ref(this->options, NULL);
- buf = gf_memdup(args.dict.dict_val, args.dict.dict_len);
- if (buf == NULL) {
- op_ret = -1;
- op_errno = ENOMEM;
- goto fail;
- }
-
- ret = dict_unserialize(buf, args.dict.dict_len, &params);
+ ret = dict_unserialize(args.dict.dict_val, args.dict.dict_len, &params);
if (ret < 0) {
- ret = dict_set_str(reply, "ERROR",
- "Internal error: failed to unserialize "
- "request dictionary");
+ ret = dict_set_sizen_str_sizen(reply, "ERROR",
+ "Internal error: failed to unserialize "
+ "request dictionary");
if (ret < 0)
gf_msg_debug(this->name, 0,
"failed to set error "
@@ -291,9 +283,6 @@ server_setvolume(rpcsvc_request_t *req)
goto fail;
}
- params->extra_free = buf;
- buf = NULL;
-
ret = dict_get_str(params, "remote-subvolume", &name);
if (ret < 0) {
ret = dict_set_str(reply, "ERROR",
@@ -727,8 +716,6 @@ fail:
dict_unref(config_params);
}
- GF_FREE(buf);
-
return 0;
}