diff options
author | Niels de Vos <ndevos@redhat.com> | 2017-10-10 13:51:46 +0200 |
---|---|---|
committer | Jeff Darcy <jeff@pl.atyp.us> | 2017-10-13 16:29:43 +0000 |
commit | 9f7bd36edf3f0a9c634db019d28335f4320ad41e (patch) | |
tree | db6e405a27b5d6237262fc954eb90b467e41c5bd /api/src | |
parent | a413c6353dbfff5221ea020ff8e1475d5ee17a81 (diff) |
gfapi: free xlator_cmdline_option_t when set through glfs_set_xlator_option()
Change-Id: I10c323477534fd50d29460cf71c246378659fca5
BUG: 1443145
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Diffstat (limited to 'api/src')
-rw-r--r-- | api/src/glfs.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/api/src/glfs.c b/api/src/glfs.c index db3ea10bb84..72a2c3724a1 100644 --- a/api/src/glfs.c +++ b/api/src/glfs.c @@ -522,7 +522,7 @@ GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_set_volfile_server, 3.4.0); /* * * Used to free the arguments allocated by glfs_set_volfile_server() */ -void +static void glfs_free_volfile_servers (cmd_args_t *cmd_args) { server_cmdline_t *server = NULL; @@ -542,6 +542,25 @@ out: return; } +static void +glfs_free_xlator_options (cmd_args_t *cmd_args) +{ + xlator_cmdline_option_t *xo = NULL; + xlator_cmdline_option_t *tmp_xo = NULL; + + if (!&(cmd_args->xlator_options)) + return; + + list_for_each_entry_safe (xo, tmp_xo, &cmd_args->xlator_options, + cmd_args) { + list_del_init (&xo->cmd_args); + GF_FREE (xo->volume); + GF_FREE (xo->key); + GF_FREE (xo->value); + GF_FREE (xo); + } +} + int pub_glfs_setfsuid (uid_t fsuid) { @@ -1092,6 +1111,8 @@ glusterfs_ctx_destroy (glusterfs_ctx_t *ctx) if (ctx->cmd_args.curr_server) glfs_free_volfile_servers (&ctx->cmd_args); + glfs_free_xlator_options (&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. |