]> git.ipfire.org Git - thirdparty/libvirt.git/commit
esx: avoid dead code
authorEric Blake <eblake@redhat.com>
Mon, 6 Jun 2011 19:19:38 +0000 (13:19 -0600)
committerEric Blake <eblake@redhat.com>
Wed, 8 Jun 2011 11:28:25 +0000 (05:28 -0600)
commit657ae229c8bb8dccba2f32b389240ac9e4feaf7e
tree62f54071f5f49ab0a1fcecd235796eda1865077a
parentba4983da47c261a54e7a080f1cb0fd3e146c4a06
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.
src/esx/esx_vi.c