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>
This commit is contained in:
Jiffin Tony Thottan 2016-06-16 15:55:47 +05:30 committed by Jeff Darcy
parent c4ddfa5b76
commit 09caa0c054

View File

@ -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.