From 87508c1edc7b8f4a88b2506ac642e878b1f2ac16 Mon Sep 17 00:00:00 2001 From: Krishnan P Date: Thu, 16 Jun 2011 01:26:55 +0000 Subject: afr: holding stack var via dict_set_static_bin corrupts. Signed-off-by: Krishnan Parthasarathi Signed-off-by: Anand Avati BUG: 3033 (Changes to replace-brick and syntask interface.) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=3033 --- xlators/cluster/afr/src/afr-common.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'xlators') diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index 2b073eb9c..a08f34b87 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -63,14 +63,27 @@ int32_t afr_set_dict_gfid (dict_t *dict, uuid_t gfid) { - int ret = 0; + int ret = 0; + uuid_t *pgfid = NULL; GF_ASSERT (gfid); - ret = dict_set_static_bin (dict, "gfid-req", gfid, 16); + pgfid = GF_CALLOC (1, sizeof (uuid_t), gf_common_mt_char); + if (!pgfid) { + ret = -1; + goto out; + } + + uuid_copy (*pgfid, gfid); + + ret = dict_set_dynptr (dict, "gfid-req", pgfid, sizeof (uuid_t)); if (ret) gf_log (THIS->name, GF_LOG_DEBUG, "gfid set failed"); +out: + if (ret && pgfid) + GF_FREE (pgfid); + return ret; } -- cgit