[libvirt] Power Hypervisor: Fix potential segfault and memleak in phypOpen
Matthias Bolte
matthias.bolte at googlemail.com
Fri Aug 7 12:50:19 UTC 2009
Hi,
I came across this line in the phypOpen function:
char string[strlen(conn->uri->path)];
Here the path part of the given URI is used without checking it for
NULL, this can cause a segfault as strlen expects a string != NULL.
Beside that uuid_db and connection_data leak in case of an error.
In this line
conn->uri->path = string;
the original path of the URI leaks. The patch adds a VIR_FREE call
before setting the new path.
The attached patch is compile-tested but I don't have a Power
Hypervisor installation at hand to test it for real.
Matthias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: phyp_fix_segfault_and_memleak_in_phypOpen.patch
Type: text/x-patch
Size: 2516 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20090807/871b2998/attachment-0001.bin>
More information about the libvir-list
mailing list