From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>, qemu-devel@nongnu.org
Cc: tgolembi@redhat.com, mdroth@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [PATCH] qga-win: fix leaks of build_guest_disk_info()
Date: Sun, 4 Nov 2018 23:30:55 +0100 [thread overview]
Message-ID: <d00e5a0e-a30e-69a6-d8fd-c748977c9191@redhat.com> (raw)
In-Reply-To: <20181103130143.7179-1-marcandre.lureau@redhat.com>
On 3/11/18 14:01, Marc-André Lureau wrote:
> Introduced in commit b1ba8890e63ce9432c41c5c3fc229f54c87c9c99, vol_h
> handle should be closed, and "out" cleanup should be done after
> DeviceIoControl() fails.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> qga/commands-win32.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/qga/commands-win32.c b/qga/commands-win32.c
> index ef1d7d48d2..62e1b51dfe 100644
> --- a/qga/commands-win32.c
> +++ b/qga/commands-win32.c
> @@ -797,7 +797,7 @@ static GuestDiskAddressList *build_guest_disk_info(char *guid, Error **errp)
> 0, extents, size, NULL, NULL)) {
> error_setg_win32(errp, GetLastError(),
> "failed to get disk extents");
> - return NULL;
> + goto out;
> }
> } else if (last_err == ERROR_INVALID_FUNCTION) {
> /* Possibly CD-ROM or a shared drive. Try to pass the volume */
> @@ -855,6 +855,9 @@ static GuestDiskAddressList *build_guest_disk_info(char *guid, Error **errp)
>
>
> out:
> + if (vol_h != INVALID_HANDLE_VALUE) {
> + CloseHandle(vol_h);
> + }
> qapi_free_GuestDiskAddress(disk);
> g_free(extents);
> g_free(name);
>
next prev parent reply other threads:[~2018-11-04 22:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-03 13:01 [Qemu-devel] [PATCH] qga-win: fix leaks of build_guest_disk_info() Marc-André Lureau
2018-11-04 22:30 ` Philippe Mathieu-Daudé [this message]
2018-11-09 14:38 ` Michael Roth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d00e5a0e-a30e-69a6-d8fd-c748977c9191@redhat.com \
--to=philmd@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=tgolembi@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).