]> git.ipfire.org Git - thirdparty/libvirt.git/commit
rpc: avoid freeing uninitialized variable
authorEric Blake <eblake@redhat.com>
Wed, 29 Jun 2011 18:28:57 +0000 (12:28 -0600)
committerEric Blake <eblake@redhat.com>
Thu, 30 Jun 2011 17:36:52 +0000 (11:36 -0600)
commit0a8a79af53a72b75fb8edd94bd3689e990c482ff
tree69c1972c9a46b4c16dd0fd12643aa02f2037e762
parentcdb0e0dc3fd2c217e6391ec134334b3dfe4410cc
rpc: avoid freeing uninitialized variable

Detected by Coverity.  Both are instances of bad things happening
if pipe2 fails; the virNetClientNew failure could free garbage,
and virNetSocketNewConnectCommand could close random fds.

Note: POSIX doesn't guarantee the contents of fd[0] and fd[1]
after pipe failure: http://austingroupbugs.net/view.php?id=467
We may need to introduce a virPipe2 wrapper that guarantees
that on pipe failure, the fds are explicitly set to -1, rather
than our current state of assuming the fds are unchanged from
their value prior to the failed pipe call.

* src/rpc/virnetclient.c (virNetClientNew): Initialize variable.
* src/rpc/virnetsocket.c (virNetSocketNewConnectCommand):
Likewise.
src/rpc/virnetclient.c
src/rpc/virnetsocket.c