[libvirt] [PATCH 4/9] virDomainObjIsActive: Allow vm->def to be NULL

Michal Privoznik posted 9 patches 5 years, 6 months ago
There is a newer version of this series
[libvirt] [PATCH 4/9] virDomainObjIsActive: Allow vm->def to be NULL
Posted by Michal Privoznik 5 years, 6 months ago
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/conf/domain_conf.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index fa0756b634..e1b5df7e46 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2766,7 +2766,7 @@ int virDomainDefValidate(virDomainDefPtr def,
 static inline bool
 virDomainObjIsActive(virDomainObjPtr dom)
 {
-    return dom->def->id != -1;
+    return dom->def && dom->def->id != -1;
 }
 
 int virDomainObjCheckActive(virDomainObjPtr dom);
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 4/9] virDomainObjIsActive: Allow vm->def to be NULL
Posted by Nikolay Shirokovskiy 5 years, 5 months ago

On 30.05.2019 12:33, Michal Privoznik wrote:
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  src/conf/domain_conf.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index fa0756b634..e1b5df7e46 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -2766,7 +2766,7 @@ int virDomainDefValidate(virDomainDefPtr def,
>  static inline bool
>  virDomainObjIsActive(virDomainObjPtr dom)
>  {
> -    return dom->def->id != -1;
> +    return dom->def && dom->def->id != -1;
>  }
>  
>  int virDomainObjCheckActive(virDomainObjPtr dom);
> 

Reviewed-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>

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