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

[Xen-changelog] [xen staging] xenforeignmemory: fix fd leakage in error path



commit e3ba4709b7d26c2a14208aa25826058fe5048cb1
Author:     Wei Liu <wei.liu2@xxxxxxxxxx>
AuthorDate: Tue Aug 28 15:19:55 2018 +0100
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Tue Aug 28 16:04:19 2018 +0100

    xenforeignmemory: fix fd leakage in error path
    
    b49ef5d3 (xenforeignmemory: work around bug in older privcmd) added an
    error path but forgot to close fd there.
    
    Spotted by Coverity.
    
    Reported-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 tools/libs/foreignmemory/linux.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/libs/foreignmemory/linux.c b/tools/libs/foreignmemory/linux.c
index 0368aa09f4..132875df8a 100644
--- a/tools/libs/foreignmemory/linux.c
+++ b/tools/libs/foreignmemory/linux.c
@@ -62,6 +62,7 @@ int osdep_xenforeignmemory_open(xenforeignmemory_handle *fmem)
     {
         xtl_log(fmem->logger, XTL_ERROR, -1, "xenforeignmemory",
                 "privcmd ioctl should not be implemented");
+        close(fd);
         return -1;
     }
     else
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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