]> git.ipfire.org Git - thirdparty/util-linux.git/commit
lscpu: fix SIGSEGV on archs without drawers & books
authorKarel Zak <kzak@redhat.com>
Mon, 17 Feb 2020 12:13:11 +0000 (13:13 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 17 Feb 2020 12:17:26 +0000 (13:17 +0100)
commitbdda3543142f20a8801f74986ba22104f960c7fa
treea955df6a431a65f3fcb1bfb9de4adc3d9ebebd7d
parent3239663361b9b009d7bf99f1529d60a18a1ea9d7
lscpu: fix SIGSEGV on archs without drawers & books

The drawers and books are optional and not supported on all
architectures and in this case drawers/books relevant arrays are not
allocated, so don't access it although user wants it
(e.g.  "lscpu -p -y --output-all").

This patch also cleans up arrays allocation to make it more readable
and robust against edit mistakes.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1801760
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/lscpu.c