]> xenbits.xensource.com Git - people/dwmw2/xen.git/commitdiff
xenforeignmemory: fix fd leakage in error path
authorWei Liu <wei.liu2@citrix.com>
Tue, 28 Aug 2018 14:19:55 +0000 (15:19 +0100)
committerWei Liu <wei.liu2@citrix.com>
Tue, 28 Aug 2018 15:04:19 +0000 (16:04 +0100)
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@citrix.com>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
tools/libs/foreignmemory/linux.c

index 0368aa09f4c892310dccc10f543441353049433a..132875df8a202800fdc3569545ce0ad1da25661a 100644 (file)
@@ -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