mirror of https://gitee.com/openkylin/libvirt.git
esx: Fix freeing of heterogeneous lists
Always call the free function of the base type. The base type function then dynamically dispatches the call to the free function for the actual type.
This commit is contained in:
parent
c38e2f7a39
commit
5cff36e39a
|
@ -684,6 +684,9 @@ class Object:
|
||||||
source += "{\n"
|
source += "{\n"
|
||||||
|
|
||||||
if self.features & Object.FEATURE__LIST:
|
if self.features & Object.FEATURE__LIST:
|
||||||
|
if self.extends is not None:
|
||||||
|
source += " esxVI_%s_Free((esxVI_%s **)&item->_next);\n\n" % (self.extends, self.extends)
|
||||||
|
else:
|
||||||
source += " esxVI_%s_Free(&item->_next);\n\n" % self.name
|
source += " esxVI_%s_Free(&item->_next);\n\n" % self.name
|
||||||
|
|
||||||
source += self.generate_free_code()
|
source += self.generate_free_code()
|
||||||
|
@ -701,6 +704,9 @@ class Object:
|
||||||
source += "{\n"
|
source += "{\n"
|
||||||
|
|
||||||
if self.features & Object.FEATURE__LIST:
|
if self.features & Object.FEATURE__LIST:
|
||||||
|
if self.extends is not None:
|
||||||
|
source += " esxVI_%s_Free((esxVI_%s **)&item->_next);\n\n" % (self.extends, self.extends)
|
||||||
|
else:
|
||||||
source += " esxVI_%s_Free(&item->_next);\n\n" % self.name
|
source += " esxVI_%s_Free(&item->_next);\n\n" % self.name
|
||||||
|
|
||||||
source += self.generate_free_code()
|
source += self.generate_free_code()
|
||||||
|
@ -1126,7 +1132,7 @@ additional_object_features = { "DatastoreInfo" : Object.FEATURE__AN
|
||||||
"FileInfo" : Object.FEATURE__DYNAMIC_CAST,
|
"FileInfo" : Object.FEATURE__DYNAMIC_CAST,
|
||||||
"FileQuery" : Object.FEATURE__DYNAMIC_CAST,
|
"FileQuery" : Object.FEATURE__DYNAMIC_CAST,
|
||||||
"HostCpuIdInfo" : Object.FEATURE__ANY_TYPE | Object.FEATURE__LIST,
|
"HostCpuIdInfo" : Object.FEATURE__ANY_TYPE | Object.FEATURE__LIST,
|
||||||
"HostDatastoreBrowserSearchResults" : Object.FEATURE__ANY_TYPE,
|
"HostDatastoreBrowserSearchResults" : Object.FEATURE__LIST | Object.FEATURE__ANY_TYPE,
|
||||||
"ManagedObjectReference" : Object.FEATURE__ANY_TYPE,
|
"ManagedObjectReference" : Object.FEATURE__ANY_TYPE,
|
||||||
"ObjectContent" : Object.FEATURE__DEEP_COPY | Object.FEATURE__LIST,
|
"ObjectContent" : Object.FEATURE__DEEP_COPY | Object.FEATURE__LIST,
|
||||||
"PerfCounterInfo" : Object.FEATURE__LIST,
|
"PerfCounterInfo" : Object.FEATURE__LIST,
|
||||||
|
|
Loading…
Reference in New Issue