]> git.ipfire.org Git - thirdparty/libvirt.git/commit
rpc: Don't leak fd via CreateXMLWithFiles
authorBen Gray <ben.r.gray@gmail.com>
Sat, 23 Apr 2016 22:38:21 +0000 (18:38 -0400)
committerCole Robinson <crobinso@redhat.com>
Wed, 4 May 2016 22:41:28 +0000 (18:41 -0400)
commit5d4a0b0084b56b02b3bf4805a68c3462984f6647
tree12d7aeaf6d428046d77529d8d5f84f01f7c41dcf
parent2442bc1c341f7c6ad4d3b3b7f6111b6d827cfb38
rpc: Don't leak fd via CreateXMLWithFiles

FD passing APIs like CreateXMLWithFiles or OpenGraphicsFD will leak
file descriptors. The user passes in an fd, which is dup()'d in
virNetClientProgramCall. The new fd is what is transfered to the
server virNetClientIOWriteMessage.

Once all the fds have been written though, the parent msg->fds list
is immediately free'd, so the individual fds are never closed.

This closes each FD as its send to the server, so all fds have been
closed by the time msg->fds is free'd.

https://bugzilla.redhat.com/show_bug.cgi?id=1159766
(cherry picked from commit 5ba48584fbc5079c0ddbc9e9a52c96d7bcef0761)
src/rpc/virnetclient.c