Static analysis reported that we were leaking 'fd' in one case in the above function, fix the error handling to go through the 'out' label.
Cc: Dan Williams <dan.j.willi...@intel.com> Signed-off-by: Vishal Verma <vishal.l.ve...@intel.com> --- ndctl/namespace.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ndctl/namespace.c b/ndctl/namespace.c index 21252b6..0550580 100644 --- a/ndctl/namespace.c +++ b/ndctl/namespace.c @@ -1958,8 +1958,10 @@ static int file_write_infoblock(const char *path) } buf = calloc(INFOBLOCK_SZ, 1); - if (!buf) - return -ENOMEM; + if (!buf) { + rc = -ENOMEM; + goto out; + } switch (util_nsmode(param.mode)) { case NDCTL_NS_MODE_FSDAX: -- 2.21.1 _______________________________________________ Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org To unsubscribe send an email to linux-nvdimm-le...@lists.01.org