]> 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>
Fri, 15 May 2020 09:45:34 +0000 (11:45 +0200)
commite3ec43a64003dcfbe8a082bd3e2d94ce7724ed89
treece2243cc41b4b5127f4f8625c5e670d9e46bb9bd
parente4894e685ce45855a1103145a60b7fce312f4498
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