[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [qemu-xen-unstable] net: don't leak an fd after an error



commit b1b6594ba444ce418fd183bedeed179ace42dab1
Author:     Kaifeng Zhu <kaifeng.zhu@xxxxxxxxxx>
AuthorDate: Fri Mar 7 16:31:06 2014 +0000
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Fri Oct 16 16:52:06 2015 +0100

    net: don't leak an fd after an error
    
    fd will be leaked if launch_script failed.
    
    Signed-off-by: Kaifeng Zhu <kaifeng.zhu@xxxxxxxxxx>
    Coverity-ID: 1055925
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 net.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/net.c b/net.c
index 720027c..f3887a7 100644
--- a/net.c
+++ b/net.c
@@ -1049,8 +1049,10 @@ static int net_tap_init(VLANState *vlan, const char 
*model,
     if (!setup_script || !strcmp(setup_script, "no"))
         setup_script = "";
     if (setup_script[0] != '\0') {
-       if (launch_script(setup_script, ifname, script_arg, fd))
+       if (launch_script(setup_script, ifname, script_arg, fd)) {
+           close(fd);
            return -1;
+       }
     }
     s = net_tap_fd_init(vlan, model, name, fd);
     if (!s)
--
generated by git-patchbot for /home/xen/git/qemu-xen-unstable.git

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.