From: Wei Liu Date: Tue, 28 Aug 2018 14:19:55 +0000 (+0100) Subject: xenforeignmemory: fix fd leakage in error path X-Git-Tag: archive/raspbian/4.14.0+80-gd101b417b7-1+rpi1^2~63^2~3384 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=e3ba4709b7d26c2a14208aa25826058fe5048cb1;p=xen.git 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 Signed-off-by: Wei Liu Reviewed-by: Andrew Cooper --- 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