summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendrabhat@gluster.com>2012-02-22 18:27:15 +0530
committerVijay Bellur <vijay@gluster.com>2012-02-22 21:21:22 -0800
commit683ce1bca3b6c541e565eec014fa7cc3308957d8 (patch)
treeec726c410b727fb40a8e6777cacee2c7325cd3d2 /libglusterfs
parentca502ca780202c71623a34349c88d114ad58ec12 (diff)
glusterfsd: unref the dict and use dict_set_dynstr to avoid memleak
Unref the new dict and use proper dict api (dict_set_dynstr) to save data for displaying volume status information, which otherwise leads to memory leak in the process. Change-Id: Icb9ceb1a867c5b9759211a67027d983ab9b7e1c2 BUG: 796186 Signed-off-by: Raghavendra Bhat <raghavendrabhat@gluster.com> Reviewed-on: http://review.gluster.com/2799 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/inode.c2
-rw-r--r--libglusterfs/src/stack.c16
2 files changed, 11 insertions, 7 deletions
diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c
index 67752da71..3fad499eb 100644
--- a/libglusterfs/src/inode.c
+++ b/libglusterfs/src/inode.c
@@ -1652,7 +1652,7 @@ inode_dump_to_dict (inode_t *inode, char *prefix, dict_t *dict)
memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "%s.gfid", prefix);
- ret = dict_set_str (dict, key, gf_strdup (uuid_utoa (inode->gfid)));
+ ret = dict_set_dynstr (dict, key, gf_strdup (uuid_utoa (inode->gfid)));
if (ret)
goto out;
diff --git a/libglusterfs/src/stack.c b/libglusterfs/src/stack.c
index 29b44aedf..787f9a318 100644
--- a/libglusterfs/src/stack.c
+++ b/libglusterfs/src/stack.c
@@ -186,7 +186,7 @@ gf_proc_dump_call_frame_to_dict (call_frame_t *call_frame,
memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "%s.translator", prefix);
- ret = dict_set_str (dict, key, gf_strdup (tmp_frame.this->name));
+ ret = dict_set_dynstr (dict, key, gf_strdup (tmp_frame.this->name));
if (ret)
return;
@@ -199,7 +199,7 @@ gf_proc_dump_call_frame_to_dict (call_frame_t *call_frame,
if (tmp_frame.parent) {
memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "%s.parent", prefix);
- ret = dict_set_str (dict, key,
+ ret = dict_set_dynstr (dict, key,
gf_strdup (tmp_frame.parent->this->name));
if (ret)
return;
@@ -208,7 +208,8 @@ gf_proc_dump_call_frame_to_dict (call_frame_t *call_frame,
if (tmp_frame.wind_from) {
memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "%s.windfrom", prefix);
- ret = dict_set_str (dict, key, gf_strdup (tmp_frame.wind_from));
+ ret = dict_set_dynstr (dict, key,
+ gf_strdup (tmp_frame.wind_from));
if (ret)
return;
}
@@ -216,7 +217,8 @@ gf_proc_dump_call_frame_to_dict (call_frame_t *call_frame,
if (tmp_frame.wind_to) {
memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "%s.windto", prefix);
- ret = dict_set_str (dict, key, gf_strdup (tmp_frame.wind_to));
+ ret = dict_set_dynstr (dict, key,
+ gf_strdup (tmp_frame.wind_to));
if (ret)
return;
}
@@ -224,7 +226,8 @@ gf_proc_dump_call_frame_to_dict (call_frame_t *call_frame,
if (tmp_frame.unwind_from) {
memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "%s.unwindfrom", prefix);
- ret = dict_set_str (dict, key, gf_strdup (tmp_frame.unwind_from));
+ ret = dict_set_dynstr (dict, key,
+ gf_strdup (tmp_frame.unwind_from));
if (ret)
return;
}
@@ -232,7 +235,8 @@ gf_proc_dump_call_frame_to_dict (call_frame_t *call_frame,
if (tmp_frame.unwind_to) {
memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "%s.unwind_to", prefix);
- ret = dict_set_str (dict, key, gf_strdup (tmp_frame.unwind_to));
+ ret = dict_set_dynstr (dict, key,
+ gf_strdup (tmp_frame.unwind_to));
}
return;