diff options
author | Pavan Sondur <pavan@gluster.com> | 2010-08-16 02:35:00 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2010-08-16 01:48:55 -0700 |
commit | 32041afec462237c44a557ccdc4a32c6e33bad96 (patch) | |
tree | 4b3b0bf0f53a1c899716b64232598d7e088dea41 /xlators/mgmt/glusterd/src/glusterd-utils.c | |
parent | fa71c7ff9d23bff6e597a87c2c58d8b620594856 (diff) |
mgmt/glusterd: Cleanup replace brick.
Signed-off-by: Pavan Vilas Sondur <pavan@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 1303 (Cleanup replace-brick state info)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1303
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 81c6cb2f4e4..959a9c99926 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -640,6 +640,7 @@ glusterd_brickinfo_get (char *brick, glusterd_volinfo_t *volinfo, int32_t ret = -1; char *hostname = NULL; char *path = NULL; + char *dup_brick = NULL; glusterd_brickinfo_t *tmp = NULL; GF_ASSERT (brick); @@ -648,7 +649,15 @@ glusterd_brickinfo_get (char *brick, glusterd_volinfo_t *volinfo, gf_log ("", GF_LOG_NORMAL, "brick: %s", brick); - hostname = strtok (brick, ":"); + dup_brick = gf_strdup (brick); + if (!dup_brick) { + gf_log ("", GF_LOG_ERROR, + "Out of memory"); + ret = -1; + goto out; + } + + hostname = strtok (dup_brick, ":"); path = strtok (NULL, ":"); GF_ASSERT (hostname); @@ -666,6 +675,10 @@ glusterd_brickinfo_get (char *brick, glusterd_volinfo_t *volinfo, *brickinfo = tmp; +out: + if (dup_brick) + GF_FREE (dup_brick); + gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); return ret; } |