qemu: Fix NULL pointer access in qemuProcessInitCpuAffinity()
commita84922c09e9e1a0ca4f8fb1e8b4b1c7b55bd79e9
authorAndrea Bolognani <abologna@redhat.com>
Thu, 6 Jun 2019 13:38:29 +0000 (6 15:38 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Thu, 6 Jun 2019 14:50:11 +0000 (6 16:50 +0200)
tree9752e4bdc496cfe2440f1844303c0666978f498e
parent01628f4b440b4cbc8cabf83422937e34c72a0c0f
qemu: Fix NULL pointer access in qemuProcessInitCpuAffinity()

Commit 2f2254c7f4e5 attempted to fix a memory leak by ensuring
cpumapToSet is always a freshly allocated bitmap, but regrettably
introduced a NULL pointer access while doing so, because it called
virBitmapCopy() without allocating the destination bitmap first.

Solve the issue by using virBitmapNewCopy() instead.

Reported-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
src/qemu/qemu_process.c