
On 01/10/2013 12:21 PM, John Ferlan wrote:
The phypUUIDTable_Push and phypUUIDTable_Pull leaked their file descriptors on normal return. Each function had an unnecessary use of creating a buffer to print conn->uri->user and needed a bit better flow control. I also noted that the Read function had a cut-n-paste error from the write function on a couple of VIR_WARN's.
The openSSHSession leaked the sock on the failure path. Additionally that turns into the internal_socket in the phypOpen code. That was neither saved nor closed on any path. So I used the connnection_data->sock field to save the socket for eventual close. Of interest here is that phypExec used the connection_data->sock field even though it had never been initialized. --- src/phyp/phyp_driver.c | 114 ++++++++++++++++++------------------------------- 1 file changed, 41 insertions(+), 73 deletions(-)
+ if (virAsprintf(&remote_file, "/home/%s/libvirt_uuid_table", + NULLSTR(conn->uri->user)) < 0) {
Indentation - NULLSTR is an argument to virAsprintf, not another condition of the if. (twice) ACK with this squashed in, so I pushed. (If you use emacs and want to know how to automatically update copyright years on any file you touch, I could propose a patch to HACKING to share that tip.) diff --git i/src/phyp/phyp_driver.c w/src/phyp/phyp_driver.c index f6c2579..74f04ff 100644 --- i/src/phyp/phyp_driver.c +++ w/src/phyp/phyp_driver.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2012 Red Hat, Inc. + * Copyright (C) 2010-2013 Red Hat, Inc. * Copyright IBM Corp. 2009 * * phyp_driver.c: ssh layer to access Power Hypervisors @@ -504,7 +504,7 @@ phypUUIDTable_Push(virConnectPtr conn) int ret = -1; if (virAsprintf(&remote_file, "/home/%s/libvirt_uuid_table", - NULLSTR(conn->uri->user)) < 0) { + NULLSTR(conn->uri->user)) < 0) { virReportOOMError(); goto cleanup; } @@ -702,7 +702,7 @@ phypUUIDTable_Pull(virConnectPtr conn) int ret = -1; if (virAsprintf(&remote_file, "/home/%s/libvirt_uuid_table", - NULLSTR(conn->uri->user)) < 0) { + NULLSTR(conn->uri->user)) < 0) { virReportOOMError(); goto cleanup; } -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org