On 24/08/18 13:16, Paul Durrant wrote:
> diff --git a/tools/libs/foreignmemory/linux.c
> b/tools/libs/foreignmemory/linux.c
> index 3686cf41e0..0368aa09f4 100644
> --- a/tools/libs/foreignmemory/linux.c
> +++ b/tools/libs/foreignmemory/linux.c
> @@ -53,6 +53,23 @@ int osdep_xenforeignmemory_open(xenforeignmemory_handle
> *fmem)
> return -1;
> }
>
> + /*
> + * Older versions of privcmd return -EINVAL for unimplemented ioctls
> + * so we need to probe for the errno to use rather than just using
> + * the conventional ENOTTY.
> + */
> + if ( ioctl(fd, IOCTL_PRIVCMD_UNIMPLEMENTED, NULL) >= 0 )
> + {
> + xtl_log(fmem->logger, XTL_ERROR, -1, "xenforeignmemory",
> + "privcmd ioctl should not be implemented");
This error path leaks fd.
~Andrew
> + return -1;
> + }
> + else
> + {
> + fmem->unimpl_errno = errno;
> + errno = 0;
> + }
> +
> fmem->fd = fd;
> return 0;
> }
>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel