esx: generator: fix free of elements in lists
esx: generator: fix free of elements in lists

When a list is freed, we iterate through all the items, invoking the
free function for each; the actual free function called for each element
is the function of the actual type of each element, and thus the @_next
pointer in the element struct has the same type as the element itself.
Currently, the free function gets the parent of the current element
type, and invoke its free function to continue freeing the list.
However, in case the hierarchy of the classes has more than 1 level
(i.e. Class <- SubClass <- SubSubClass), the invoked free function is
only the parent class' one, and not the actual base class of the
hierarchy.

To fix that, change the generator to get the base class of a class, and
invoking that instead.  Also, avoid to set the @_next back, as it is not
needed.

Fixes commits 5cff36e39ae691fbd7c40597df1732eecf294150 and
f76c6dde2e33233566e886d96e76b5fe0c102d9a.

Signed-off-by: Pino Toscano <7f561d60bf2df812acf624afe597ba9d84c2586d@redhat.com>
Reviewed-by: Martin Kletzander <e82f23e74d43760279ebcc505dac4ae70d5627d0@redhat.com>

olafhering/libvirt,crobinso/libvirt,crobinso/libvirt,jfehlig/libvirt,libvirt/libvirt,jardasgit/libvirt,jfehlig/libvirt,olafhering/libvirt,jardasgit/libvirt,crobinso/libvirt,nertpinx/libvirt,olafhering/libvirt,zippy2/libvirt,libvirt/libvirt,nertpinx/libvirt,libvirt/libvirt,nertpinx/libvirt,crobinso/libvirt,jardasgit/libvirt,jfehlig/libvirt,nertpinx/libvirt,libvirt/libvirt,zippy2/libvirt,nertpinx/libvirt,zippy2/libvirt,zippy2/libvirt,jfehlig/libvirt,jardasgit/libvirt,olafhering/libvirt,jardasgit/libvirt