]> git.ipfire.org Git - thirdparty/libvirt.git/commit
esx: Simplify esxPrivate pointer handling in esxOpen
authorMatthias Bolte <matthias.bolte@googlemail.com>
Thu, 10 Jan 2013 21:32:13 +0000 (22:32 +0100)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Sat, 2 Feb 2013 11:26:50 +0000 (12:26 +0100)
commitee47d23629375a5386c7eea23abe644f2799d16d
tree1b018adc03cafb1d9e98cf96889c0559b2d8dbae
parentb2aa03b3f78bb5a1427527055cd0b77802d58b86
esx: Simplify esxPrivate pointer handling in esxOpen

Commit 4445e16bfa8056980ac643fabf17186f9e685925 changed the signature
of esxConnectToHost and esxConnectToVCenter by replacing the esxPrivate
pointer with virConnectPtr. The esxPrivate pointer was then retrieved
again from virConnectPtr's privateData. This resulted in a NULL pointer
dereference, because the privateData pointer was not yet initialized at
the point where esxConnectToHost and esxConnectToVCenter are called.

This was fixed in commit b126715a48cd0cbe32ec6468c267cd8cf2961c55 that
moved the initialization of privateData before the problematic calls.

Simplify the logic by making the call to esxFreePrivate unconditional and
changing esxConnectToHost and esxConnectToVCenter back to take a esxPrivate
pointer directly. This allows to assign esxPrivate to the virConnectPtr's
privateData pointer as one of the last steps in esxOpen making it more
obvious that it is not initialized during the earlier steps of esxOpen.
src/esx/esx_driver.c