[libvirt PATCH] esx: generator: fix free of elements in lists

Martin Kletzander mkletzan at redhat.com
Thu Sep 10 12:27:18 UTC 2020


On Thu, Sep 10, 2020 at 01:44:34PM +0200, Pino Toscano wrote:
>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 ancestor of a class, and
>invoking that instead.  Also, avoid to set the @_next back, as it is not
>needed.
>

I would say "base class" except "ancestor" because the naming confused me, but
other than that it looks good to me.

Reviewed-by: Martin Kletzander <mkletzan at redhat.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20200910/9958cfb5/attachment-0001.sig>


More information about the libvir-list mailing list