]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lscpu: fix resource leak [coverity scan]
authorKarel Zak <kzak@redhat.com>
Thu, 19 Nov 2020 11:00:58 +0000 (12:00 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 19 Nov 2020 11:00:58 +0000 (12:00 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/lscpu-cputype.c

index e478d2acc6d62a4f218384cd6dc60d99b9c6d026..834e1c663213d17acfc5068eb4f2a63c1259be96 100644 (file)
@@ -769,8 +769,10 @@ int lscpu_read_vulnerabilities(struct lscpu_cxt *cxt)
        cxt->nvuls = n = 0;
        while (xreaddir(dir))
                n++;
-       if (!n)
+       if (!n) {
+               closedir(dir);
                return 0;
+       }
 
        rewinddir(dir);
        cxt->vuls = xcalloc(n, sizeof(struct lscpu_vulnerability));