From f9ab9effc559f63754805c4fc7d090bef495b8d9 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Thu, 4 Jun 2015 13:20:12 +0200 Subject: [PATCH] conf: Fix mistakes in pointer usage in virDomainObjGetDefs Coverity rightfully determined that in commit 3d021381c71221e563182f03 I made a mistake in the first check if @persDef is not NULL is dereferencing it rather than checking. Additionally if the vm is online the code would set @liveDef twice rather than modifying @persDef. Fix both mistakes. --- src/conf/domain_conf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 77e198cc22..36de844199 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2927,7 +2927,7 @@ virDomainObjGetDefs(virDomainObjPtr vm, if (liveDef) *liveDef = NULL; - if (*persDef) + if (persDef) *persDef = NULL; if (virDomainObjUpdateModificationImpact(vm, &flags) < 0) @@ -2938,7 +2938,7 @@ virDomainObjGetDefs(virDomainObjPtr vm, *liveDef = vm->def; if (persDef) - *liveDef = vm->newDef; + *persDef = vm->newDef; } else { if (persDef) *persDef = vm->def; -- GitLab