qemu: checkpoint: fix NULL dereference at create time

Message ID 425bd547c5348dc28f885a70fed0a94a0c4e028b.1575848405.git.crobinso@redhat.com
State Accepted
Commit 4ce7e743dfe4177197909814e62636446cac4012
Headers show
Series
  • qemu: checkpoint: fix NULL dereference at create time
Related show

Commit Message

Cole Robinson Dec. 8, 2019, 11:40 p.m.
'cfg' is never initialized here, which causes a crash
later in qemuCheckpointCreateFinalize

Signed-off-by: Cole Robinson <crobinso@redhat.com>

---
 src/qemu/qemu_checkpoint.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.23.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Comments

Peter Krempa Dec. 9, 2019, 6:14 a.m. | #1
On Sun, Dec 08, 2019 at 18:40:05 -0500, Cole Robinson wrote:
> 'cfg' is never initialized here, which causes a crash

> later in qemuCheckpointCreateFinalize

> 

> Signed-off-by: Cole Robinson <crobinso@redhat.com>

> ---

>  src/qemu/qemu_checkpoint.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)


Reviewed-by: Peter Krempa <pkrempa@redhat.com>


I have the same patch in my not-yet-posted series which integrates
snapshot handling and checkpoints.

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Patch

diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c
index d5af6b99bf..58cf337833 100644
--- a/src/qemu/qemu_checkpoint.c
+++ b/src/qemu/qemu_checkpoint.c
@@ -468,7 +468,7 @@  qemuCheckpointCreateXML(virDomainPtr domain,
     bool update_current = true;
     bool redefine = flags & VIR_DOMAIN_CHECKPOINT_CREATE_REDEFINE;
     unsigned int parse_flags = 0;
-    g_autoptr(virQEMUDriverConfig) cfg = NULL;
+    g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
     g_autoptr(virCaps) caps = NULL;
     g_autoptr(virDomainCheckpointDef) def = NULL;