]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lscpu: dereferencing NULL pointer [coverity scan]
authorKarel Zak <kzak@redhat.com>
Tue, 31 Jan 2012 14:00:52 +0000 (15:00 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 31 Jan 2012 14:00:52 +0000 (15:00 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/lscpu.c

index 5214a1278012a20e65966d5bf7020e62963e4f5a..a9ca2fe595ff18b2756aafe7722d3364372ac331 100644 (file)
@@ -1322,7 +1322,9 @@ int main(int argc, char *argv[])
                read_configured(desc, i);
        }
 
-       qsort(desc->caches, desc->ncaches, sizeof(struct cpu_cache), cachecmp);
+       if (desc->caches)
+               qsort(desc->caches, desc->ncaches,
+                               sizeof(struct cpu_cache), cachecmp);
 
        read_nodes(desc);
        read_hypervisor(desc);