Skip Menu |

This queue is for tickets about the Sys-Virt CPAN distribution.

Report information
The Basics
Id: 44674
Status: resolved
Priority: 0/
Queue: Sys-Virt

People
Owner: Nobody in particular
Requestors: skasal [...] redhat.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.2.0
Fixed in: (no value)



Subject: free() the arrays before _croak_error()
Several of the methods bail out using _croak_error(). Shouldn't the allocated array be freed before that? (The patch comes from Fedora perl-Sys-Virt-0.2.0-1.fc11 rpm.
Subject: perl-Sys-Virt-free.patch
2009-03-30 Stepan Kasal <skasal@redhat.com> * Virt.xs: call Safefree before bailing out. Adapted from a similar patch to Sys-Virt-0.1.2. diff -urpN Sys-Virt-0.2.0.orig/Virt.xs Sys-Virt-0.2.0/Virt.xs --- Sys-Virt-0.2.0.orig/Virt.xs 2009-03-27 20:45:33.000000000 +0100 +++ Sys-Virt-0.2.0/Virt.xs 2009-03-30 16:51:16.000000000 +0200 @@ -670,6 +670,7 @@ list_domain_ids(con, maxids) PPCODE: Newx(ids, maxids, int); if ((nid = virConnectListDomains(con, ids, maxids)) < 0) { + Safefree(ids); _croak_error(virConnGetLastError(con)); } EXTEND(SP, nid); @@ -700,7 +701,7 @@ list_defined_domain_names(con, maxnames) PPCODE: Newx(names, maxnames, char *); if ((ndom = virConnectListDefinedDomains(con, names, maxnames)) < 0) { - free(names); + Safefree(names); _croak_error(virConnGetLastError(con)); } EXTEND(SP, ndom); @@ -731,6 +732,7 @@ list_network_names(con, maxnames) PPCODE: Newx(names, maxnames, char *); if ((nnet = virConnectListNetworks(con, names, maxnames)) < 0) { + Safefree(names); _croak_error(virConnGetLastError(con)); } EXTEND(SP, nnet); @@ -762,7 +764,7 @@ list_defined_network_names(con, maxnames PPCODE: Newx(names, maxnames, char *); if ((ndom = virConnectListDefinedNetworks(con, names, maxnames)) < 0) { - free(names); + Safefree(names); _croak_error(virConnGetLastError(con)); } EXTEND(SP, ndom); @@ -793,6 +795,7 @@ list_storage_pool_names(con, maxnames) PPCODE: Newx(names, maxnames, char *); if ((nnet = virConnectListStoragePools(con, names, maxnames)) < 0) { + Safefree(names); _croak_error(virConnGetLastError(con)); } EXTEND(SP, nnet); @@ -824,7 +827,7 @@ list_defined_storage_pool_names(con, max PPCODE: Newx(names, maxnames, char *); if ((ndom = virConnectListDefinedStoragePools(con, names, maxnames)) < 0) { - free(names); + Safefree(names); _croak_error(virConnGetLastError(con)); } EXTEND(SP, ndom); @@ -859,6 +862,7 @@ list_node_device_names(con, cap, maxname PPCODE: Newx(names, maxnames, char *); if ((nnet = virNodeListDevices(con, cap, names, maxnames, flags)) < 0) { + Safefree(names); _croak_error(virConnGetLastError(con)); } EXTEND(SP, nnet);
On Mon Mar 30 11:11:05 2009, kasal wrote: Show quoted text
> Several of the methods bail out using _croak_error(). > Shouldn't the allocated array be freed before that? > (The patch comes from Fedora perl-Sys-Virt-0.2.0-1.fc11 rpm.
I've applied this patch, and a bunch more errors on a similar theme in the upstream repo: http://libvirt.org/hg/libvirt-perl/rev/369490642036 it'll be included in the next bugfix release. I'll leave this ticket open till that time.
This patch & more similar problems are included in the 0.2.1 release