[libvirt] [PATCH 09/12] esx: avoid dead code

Eric Blake eblake at redhat.com
Mon Jun 6 19:43:01 UTC 2011


Detected by Coverity.  The beginning of the function already filtered
out NULL objectContentList as invalid; more likely, the code was
trying to see if esxVI_RetrieveProperties modified *objectContentList.

* src/esx/esx_vi.c (esxVI_LookupObjectContentByType): Check
correct pointer.
---

Matthias, I'm not sure if this is the correct fix, because I don't
know how escVI_RetrieveProperties is supposed to work.

 src/esx/esx_vi.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index c5c38ca..64e5b73 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -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 at 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:
-- 
1.7.4.4




More information about the libvir-list mailing list