diff options
author | Kaushik BV <kaushikbv@gluster.com> | 2011-08-08 15:13:57 +0530 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-08-08 03:42:26 -0700 |
commit | a279af40f11a437fabc5b59234e677282bea246b (patch) | |
tree | ffe0eb5c162c42fd83d2bd289b973e59c2039f3a /xlators/mgmt/glusterd/src | |
parent | 9b479c4beebef8c9aad92182d943b2fede6e03f2 (diff) |
mgmt/glusterd: volume set help/help-xml minor fixes
- fix few typos in description
- fix the memory leak
- add an explicit flush call to flush the contents of xmlWriter to buffer
Change-Id: Iae58b117361e3701ee31fbd65890734312289203
BUG: 2041
Reviewed-on: http://review.gluster.com/191
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volgen.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index 1c0d1c11d39..61a485202c8 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -1332,6 +1332,16 @@ end_sethelp_xml_doc (xmlTextWriterPtr writer) ret = -1; goto out; } + + ret = xmlTextWriterFlush (writer); + if (ret < 0) { + gf_log ("glusterd", GF_LOG_ERROR, "Could not flush an " + "xmlDocument"); + ret = -1; + goto out; + } + + ret = 0; out: gf_log ("glusterd", GF_LOG_DEBUG, "Returning %d", ret); @@ -1492,7 +1502,9 @@ glusterd_get_volopt_content (gf_boolean_t xml_out) char *xlator_type = NULL; void *dl_handle = NULL; - volume_opt_list_t vol_opt_handle; + volume_opt_list_t vol_opt_handle; + volume_opt_list_t *vol_opt = NULL; + volume_opt_list_t *tmp = NULL; char *key = NULL; struct volopt_map_entry *vme = NULL; int ret = -1; @@ -1521,6 +1533,8 @@ glusterd_get_volopt_content (gf_boolean_t xml_out) goto out; } + INIT_LIST_HEAD (&vol_opt_handle.list); + for (vme = &glusterd_volopt_map[0]; vme->key; vme++) { if ( ( vme->type == NO_DOC) || (vme->type == GLOBAL_NO_DOC) ) @@ -1572,6 +1586,9 @@ glusterd_get_volopt_content (gf_boolean_t xml_out) else #if (HAVE_LIB_XML) output = gf_strdup ((char *)buf->content); + xmlFreeTextWriter (writer); + xmlBufferFree (buf); + #else gf_log ("glusterd", GF_LOG_ERROR, "Libxml not present"); #endif @@ -1583,6 +1600,11 @@ glusterd_get_volopt_content (gf_boolean_t xml_out) ret = dict_set_dynstr (ctx, "help-str", output); out: + list_for_each_entry_safe (vol_opt, tmp, &vol_opt_handle.list, list) { + list_del_init (&vol_opt->list); + GF_FREE (vol_opt); + } + gf_log ("glusterd", GF_LOG_DEBUG, "Returning %d", ret); return ret; |