nvmf: Free traddr/trsvc strings during config parsing

Change-Id: I10ab386a86a27e19ad571a9239039cc5a6c766f3
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Ben Walker 2016-08-05 15:51:56 -07:00
parent 644b903b6c
commit 55ec46aac6
2 changed files with 19 additions and 0 deletions

View File

@ -432,6 +432,9 @@ spdk_nvmf_parse_subsystem(struct spdk_conf_section *sp)
}
spdk_nvmf_subsystem_add_listener(subsystem, transport, traddr, trsvc);
free(traddr);
free(trsvc);
}
/* Parse Host sections */

View File

@ -174,8 +174,20 @@ spdk_nvmf_subsystem_add_listener(struct spdk_nvmf_subsystem *subsystem,
if (!listen_addr) {
return -1;
}
listen_addr->traddr = strdup(traddr);
if (!listen_addr->traddr) {
free(listen_addr);
return -1;
}
listen_addr->trsvc = strdup(trsvc);
if (!listen_addr->trsvc) {
free(listen_addr->traddr);
free(listen_addr);
return -1;
}
listen_addr->transport = transport;
TAILQ_INSERT_HEAD(&subsystem->listen_addrs, listen_addr, link);
@ -194,6 +206,10 @@ spdk_nvmf_subsystem_add_host(struct spdk_nvmf_subsystem *subsystem, char *host_n
return -1;
}
host->nqn = strdup(host_nqn);
if (!host->nqn) {
free(host);
return -1;
}
TAILQ_INSERT_HEAD(&subsystem->hosts, host, link);
subsystem->num_hosts++;