summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiffin Tony Thottan <jthottan@redhat.com>2016-06-16 15:55:47 +0530
committerJeff Darcy <jdarcy@redhat.com>2016-06-30 15:21:48 -0700
commit09caa0c054c85f030c194362cbf3c687b4a56106 (patch)
tree0c16774398bac684004d03dfabf6a1012667119f
parentc4ddfa5b76690db66fb22518d12226e2bf9cb236 (diff)
libgfapi : free parameters allocated by glfs_set_volfile_server()
This change introduce new function glfs_free_volfile_server which frees the variables allocated by glfs_set_volfile_server during glfs_fini() Change-Id: I8b1806c56e3431c33e4e8c17f9e8aa17a28a2f5c BUG: 1347249 Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> Reviewed-on: http://review.gluster.org/14743 Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Niels de Vos <ndevos@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
-rw-r--r--api/src/glfs.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/api/src/glfs.c b/api/src/glfs.c
index 8db206de007..c7bf6cd483e 100644
--- a/api/src/glfs.c
+++ b/api/src/glfs.c
@@ -496,6 +496,28 @@ invalid_fs:
GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_set_volfile_server, 3.4.0);
+/* *
+ * Used to free the arguments allocated by glfs_set_volfile_server()
+ */
+void
+glfs_free_volfile_servers (cmd_args_t *cmd_args)
+{
+ server_cmdline_t *server = NULL;
+ server_cmdline_t *tmp = NULL;
+
+ GF_VALIDATE_OR_GOTO (THIS->name, cmd_args, out);
+
+ list_for_each_entry_safe (server, tmp, &cmd_args->volfile_servers,
+ list) {
+ list_del_init (&server->list);
+ GF_FREE (server->volfile_server);
+ GF_FREE (server->transport);
+ GF_FREE (server);
+ }
+ cmd_args->curr_server = NULL;
+out:
+ return;
+}
int
pub_glfs_setfsuid (uid_t fsuid)
@@ -1020,6 +1042,9 @@ glusterfs_ctx_destroy (glusterfs_ctx_t *ctx)
if (ctx == NULL)
return 0;
+ if (ctx->cmd_args.curr_server)
+ glfs_free_volfile_servers (&ctx->cmd_args);
+
/* For all the graphs, crawl through the xlator_t structs and free
* all its members except for the mem_acct member,
* as GF_FREE will be referencing it.