]> xenbits.xensource.com Git - libvirt.git/commit
virdomainjob: preserveJob: memdup the cb structure instead of copying it
authorKristina Hanicova <khanicov@redhat.com>
Thu, 29 Sep 2022 11:56:30 +0000 (13:56 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 29 Sep 2022 12:03:20 +0000 (14:03 +0200)
commitba884de786e07e2a3addd68f2e587e306ee16cab
tree22ed2833b8b2f023d05baaa928b56a537406fe83
parent8ead926cb46f1892116cb56aa89390d194ce0b71
virdomainjob: preserveJob: memdup the cb structure instead of copying it

In case of variable 'oldjob' (job structure) in
qemuProcessReconnect() the cb pointer was just copied from the
existing job structure in virDomainObjPreserveJob(). This caused
the job and oldjob sharing the same pointer, which was later
freed at the end of the qemuProcessReconnect() function by
automatic call to virDomainObjClearJob(). This caused an invalid
read in and subsequent daemon crash as the job structure was
trying to read cb which had been already freed.

This patch changes the copying to g_memdup that allocates
different pointer, which can be later safely freed.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/conf/virdomainjob.c