Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Backports:SLE-15-SP6
libvirt-cim
f6b7eeaf.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File f6b7eeaf.patch of Package libvirt-cim
Ported by: Adam Majer <amajer@suse.de> Date: Tue Jan 9 09:57:22 CET 2018 commit f6b7eeaf097b6441ed7928c7130582a83bba5f7d Author: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> Date: Fri Sep 6 14:09:55 2013 +0200 libxkutil: Plug memory leaks in device parsing Fixed a number of memory leaks detected while running xml_parse_test under valgrind. Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com> Index: libvirt-cim-0.6.3/libxkutil/device_parsing.c =================================================================== --- libvirt-cim-0.6.3.orig/libxkutil/device_parsing.c +++ libvirt-cim-0.6.3/libxkutil/device_parsing.c @@ -94,6 +94,8 @@ static void cleanup_net_device(struct ne free(dev->device); free(dev->net_mode); free(dev->filter_ref); + free(dev->poolid); + cleanup_vsi_device(&dev->vsi); } static void cleanup_emu_device(struct emu_device *dev) @@ -594,6 +596,7 @@ static int parse_mem_device(xmlNode *nod struct virt_device *vdev = NULL; struct mem_device *mdev = NULL; char *content = NULL; + int ret = 0; vdev = calloc(1, sizeof(*vdev)); if (vdev == NULL) @@ -608,17 +611,15 @@ static int parse_mem_device(xmlNode *nod else if (XSTREQ(node->name, "memory")) sscanf(content, "%" PRIu64, &mdev->maxsize); - free(content); - *vdevs = vdev; - - return 1; + vdev = NULL; + ret = 1; err: free(content); free(vdev); - return 0; + return ret; } static char *get_attr_value_default(xmlNode *node, char *attrname, @@ -806,7 +807,10 @@ static int do_parse(xmlNodeSet *nsv, dev } out: - *l = list; + if (list) { + free(*l); + *l = list; + } return lstidx; } @@ -1159,7 +1163,7 @@ static int parse_features(struct domain static void set_action(int *val, xmlNode *child) { - const char *action = (char *)xmlNodeGetContent(child); + char *action = (char *)xmlNodeGetContent(child); if (action == NULL) *val = CIM_VSSD_RECOVERY_NONE; @@ -1171,6 +1175,8 @@ static void set_action(int *val, xmlNode *val = CIM_VSSD_RECOVERY_RESTART; else *val = CIM_VSSD_RECOVERY_NONE; + + xmlFree(action); } static int parse_domain(xmlNodeSet *nsv, struct domain *dominfo) @@ -1318,9 +1324,11 @@ void cleanup_dominfo(struct domain **dom dom = *dominfo; free(dom->name); + free(dom->typestr); free(dom->uuid); free(dom->bootloader); free(dom->bootloader_args); + free(dom->clock); if (dom->type == DOMAIN_XENPV) { free(dom->os_info.pv.type); @@ -1345,6 +1353,7 @@ void cleanup_dominfo(struct domain **dom CU_DEBUG("Unknown domain type %i", dom->type); } + cleanup_virt_devices(&dom->dev_emu, 1); cleanup_virt_devices(&dom->dev_mem, dom->dev_mem_ct); cleanup_virt_devices(&dom->dev_net, dom->dev_net_ct); cleanup_virt_devices(&dom->dev_disk, dom->dev_disk_ct);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor