[libvirt] [PATCH] esx: drop dead code to silence Coverity

Coverity detected that the only way to get to the cleanup label is if objectSpec had been successfully allocated, so the null check was dead code. * src/esx/esx_vi.c (esxVI_LookupObjectContentByType): Drop redundant null check. --- I'll wait for a review on this one. src/esx/esx_vi.c | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c index 4a8c709..8bcd76c 100644 --- a/src/esx/esx_vi.c +++ b/src/esx/esx_vi.c @@ -1763,11 +1763,8 @@ esxVI_LookupObjectContentByType(esxVI_Context *ctx, * Remove values given by the caller from the data structures to prevent * them from being freed by the call to esxVI_PropertyFilterSpec_Free(). */ - if (objectSpec != NULL) { - objectSpec->obj = NULL; - objectSpec->selectSet = NULL; - } - + objectSpec->obj = NULL; + objectSpec->selectSet = NULL; if (propertySpec != NULL) { propertySpec->type = NULL; propertySpec->pathSet = NULL; -- 1.7.4.4

On 14.10.2011 00:08, Eric Blake wrote:
Coverity detected that the only way to get to the cleanup label is if objectSpec had been successfully allocated, so the null check was dead code.
* src/esx/esx_vi.c (esxVI_LookupObjectContentByType): Drop redundant null check. ---
ACK, agree that if we reach cleanup label, there is no way for objectSpec to be NULL. Michal

On 10/14/2011 12:28 AM, Michal Privoznik wrote:
On 14.10.2011 00:08, Eric Blake wrote:
Coverity detected that the only way to get to the cleanup label is if objectSpec had been successfully allocated, so the null check was dead code.
* src/esx/esx_vi.c (esxVI_LookupObjectContentByType): Drop redundant null check. ---
ACK,
agree that if we reach cleanup label, there is no way for objectSpec to be NULL.
Pushed. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

2011/10/14 Eric Blake <eblake@redhat.com>:
Coverity detected that the only way to get to the cleanup label is if objectSpec had been successfully allocated, so the null check was dead code.
* src/esx/esx_vi.c (esxVI_LookupObjectContentByType): Drop redundant null check. ---
ACK. Eric, I'll probably have a look at your pending ESX (and VBox?) snapshot patches tomorrow. -- Matthias Bolte http://photron.blogspot.com
participants (3)
-
Eric Blake
-
Matthias Bolte
-
Michal Privoznik