[libvirt] [PATCH 1/3] lxc: Resolve Coverity warning
Peter Krempa
pkrempa at redhat.com
Tue Jul 23 16:10:29 UTC 2013
On 07/23/13 17:59, John Ferlan wrote:
> Commit 'c8695053' resulted in the following:
>
> Coverity error seen in the output:
> ERROR: REVERSE_INULL
> FUNCTION: lxcProcessAutoDestroy
>
> Due to the 'dom' being checked before 'dom->persistent' since 'dom'
> is already dereferenced prior to that.
> ---
> src/lxc/lxc_process.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
> index 5b83ccb..5c4f8c8 100644
> --- a/src/lxc/lxc_process.c
> +++ b/src/lxc/lxc_process.c
> @@ -74,7 +74,7 @@ lxcProcessAutoDestroy(virDomainObjPtr dom,
> VIR_DOMAIN_EVENT_STOPPED_DESTROYED);
> priv->doneStopEvent = true;
>
> - if (dom && !dom->persistent) {
> + if (!dom->persistent) {
> virDomainObjListRemove(driver->domains, dom);
> dom = NULL;
> }
>
ACK, dom is indeed dereferenced before, thus it will not crash here.
Peter
More information about the libvir-list
mailing list