mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 09:17:52 +03:00
esx: avoid dead code
Detected by Coverity. The beginning of the function already filtered out NULL objectContentList as invalid. Further investigation shows: esxVI_RetrieveProperties is generated and returns a list of objects that match the given propertyFilterSpec. esxVI_LookupObjectContentByType then tests whether the result corresponds to the expected occurrence and reports an error otherwise. This simplifies the callers of esxVI_LookupObjectContentByType, but due to the missing dereference the check was never performed because the code thought that at least one item was obtained. NULL represents an empty list. This is a potential segfault fix because callers of esxVI_LookupObjectContentByType that specified "required" occurrence assume *objectContentList to be non-NULL when esxVI_LookupObjectContentByType succeeds. * src/esx/esx_vi.c (esxVI_LookupObjectContentByType): Check correct pointer.
This commit is contained in:
parent
ba4983da47
commit
657ae229c8
@ -2,7 +2,7 @@
|
||||
/*
|
||||
* esx_vi.c: client for the VMware VI API 2.5 to manage ESX hosts
|
||||
*
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
* Copyright (C) 2010-2011 Red Hat, Inc.
|
||||
* Copyright (C) 2009-2011 Matthias Bolte <matthias.bolte@googlemail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
@ -1737,7 +1737,7 @@ esxVI_LookupObjectContentByType(esxVI_Context *ctx,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (objectContentList == NULL) {
|
||||
if (*objectContentList == NULL) {
|
||||
switch (occurrence) {
|
||||
case esxVI_Occurrence_OptionalItem:
|
||||
case esxVI_Occurrence_OptionalList:
|
||||
|
Loading…
Reference in New Issue
Block a user