From: Minwoo Im Date: Sat, 6 Apr 2019 21:45:16 +0000 (+0900) Subject: ioctl: Free memory if get_property for fabrics failed X-Git-Tag: v1.8~3^2 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=07a2e53c9d7b737c37f88a31e381ef22d0ae3337;p=users%2Fsagi%2Fnvme-cli.git ioctl: Free memory if get_property for fabrics failed The given *pbar is allocated inside this function without freeing it will be freed from the caller in case of show-regs subcommand for NVMe-oF controller. If Get Property is failed because it has PCIe transport, then it needs to be freed here instead of caller. Signed-off-by: Minwoo Im --- diff --git a/nvme-ioctl.c b/nvme-ioctl.c index dbd8843b..e1f010d0 100644 --- a/nvme-ioctl.c +++ b/nvme-ioctl.c @@ -626,6 +626,8 @@ int nvme_get_properties(int fd, void **pbar) err = get_property_helper(fd, offset, *pbar + offset, &advance); if (!err) ret = 0; + else + free(*pbar); } return ret;