nvme/examples: fix potential memory leak in reconnect.c

Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: Ib410cde580dc903f7185d001dbd434e6db64c57d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1987
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Seth Howell 2020-04-22 17:08:39 -07:00 committed by Tomasz Zawadzki
parent 4dc4d5cd3c
commit e5c4b63382

View File

@ -663,6 +663,7 @@ add_trid(const char *trid_str)
len = strcspn(alt_traddr, " \t\n");
if (len > SPDK_NVMF_TRADDR_MAX_LEN) {
fprintf(stderr, "The failover traddr %s is too long.\n", alt_traddr);
free(trid_entry);
return -1;
}
snprintf(trid_entry->failover_trid.traddr, SPDK_NVMF_TRADDR_MAX_LEN + 1, "%s", alt_traddr);