Whamcloud - gitweb
LU-11899 utils: Possible resource/memory leaks 29/34129/2
authorThomas Stibor <t.stibor@gsi.de>
Tue, 29 Jan 2019 15:09:07 +0000 (16:09 +0100)
committerOleg Drokin <green@whamcloud.com>
Wed, 6 Feb 2019 06:35:22 +0000 (06:35 +0000)
Static checker revealed possible resource/memory leaks
of file handle and process pipe.

Signed-off-by: Thomas Stibor <t.stibor@gsi.de>
Change-Id: I4ee05a8325408370bcfb5e9b8d30253107115c7b
Reviewed-on: https://review.whamcloud.com/34129
Tested-by: Jenkins
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
Reviewed-by: Shilong Wang <wshilong@ddn.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/utils/gss/lsupport.c
lustre/utils/lfs_project.c

index e93c4e9..15eaa7c 100644 (file)
@@ -246,6 +246,7 @@ int external_nid2hostname(char *lnd, uint32_t net, uint32_t addr,
         head = fgets(buf, bufsize, fghn);
         if (head == NULL) {
                 printerr(0, "can't read from %s\n", gethostname_ex);
+               pclose(fghn);
                 return -1;
         }
         if (pclose(fghn) == -1)
index 03de7d5..d61b038 100644 (file)
@@ -90,6 +90,7 @@ static int project_get_xattr(const char *pathname, struct fsxattr *fsx)
        if (ret) {
                fprintf(stderr, "%s: failed to get xattr for '%s': %s\n",
                        progname, pathname, strerror(errno));
+               close(fd);
                return -errno;
        }
        return fd;