summaryrefslogtreecommitdiffstats
path: root/cli/src/cli-xml-output.c
diff options
context:
space:
mode:
authorVijay Bellur <vbellur@redhat.com>2013-04-07 21:39:18 +0530
committerAnand Avati <avati@redhat.com>2013-04-08 14:22:28 -0700
commit108475decfde8fd30818c37604ef8db837220624 (patch)
tree2eeb3a6169ac87032e26b9e1fd626bf5d8ad7dec /cli/src/cli-xml-output.c
parente0fac0b68ff23a87da3eda4ced7a60b3e2fcf77a (diff)
cli: Address a double free with volume info.
Crash is observed when volume info is performed on a non-exisiting volume name and the output format is xml. Change-Id: I88aa5d9dc954b1352f5cc3b5b38742c832bc1bb8 BUG: 949298 Signed-off-by: Vijay Bellur <vbellur@redhat.com> Reviewed-on: http://review.gluster.org/4785 Reviewed-by: Kaushal M <kaushal@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'cli/src/cli-xml-output.c')
-rw-r--r--cli/src/cli-xml-output.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/cli/src/cli-xml-output.c b/cli/src/cli-xml-output.c
index 543ea713d17..72e1264f78c 100644
--- a/cli/src/cli-xml-output.c
+++ b/cli/src/cli-xml-output.c
@@ -2495,12 +2495,12 @@ cli_xml_output_vol_info (cli_local_t *local, dict_t *dict)
ret = xmlTextWriterEndElement (local->writer);
XML_RET_CHECK_AND_GOTO (ret, out);
}
- GF_FREE (local->get_vol.volname);
+
if (volname) {
+ GF_FREE (local->get_vol.volname);
local->get_vol.volname = gf_strdup (volname);
local->vol_count += count;
}
-
out:
gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret);
return ret;